Hello, I am working on a project I call PyGM(Python Game Maker). Game
Maker(GM) is a game engine which uses its own scripting language called
GML(Game Maker Language). PyGM aims to add Game Maker functions to python.
Python is a much more elegant language than GML however GML has some nice
functions which I wish Python had.
PyGM uses pyglet. In GM you can add a sprite to your game by calling
sprite_add.
in GML a snippet of code might look something like:
//sprite_add(file_name, image_number, remove_background, smooth, x_orig,
y_orig)
//image_number is for animations... if there are 10 images it will load 10
images from the sprite strip
//smooth is a sort of blur and I dont think it is useful
//x_orig and y_orig is where you define the center of the sprite. a 32x32
sprite would usually be 16x16 if you planned on rotating the image
goblin_sprite = sprite_add("goblin.png", 10, True, False, 16, 16); //Load
Sprite and save it in goblin_sprite variable
sprite_index = goblin_sprite; //sets the current Entity's Sprite to
goblin_sprite
sprite_number = 9; //set the current image in the animation
image_speed = .5; // lets cut the animation speed in half
image_angle = 120;// also we can rotate the image 0-360
in PyGM I was aiming for the same kind of functionality but am unsure how
to go about it because there are so many moving parts. here is what it
might look like
class Goblin(Entity):
__init__(self, **kw):
super(Goblin, self).__init__(**kw)
my_sprite = pygm.sprite_add("goblin.png", image_number = 10,
image_rows=10, image_columns=1, remove_background = True, x_orig = 16,
y_orig = 16)
my_sprite.image = 9
my_sprite.image_speed = .5
my_sprite.angle = 120
the Goblin class would automatically draw that sprite at its given x and y
coordinates offset by the sprites x_orig and y_orig and rotated by the
angle. I have no idea how to implement this. Would I be replacing
pyglet.sprite.Sprite? I would also need to allow sprite batching too which
is something GM has not had for a long time(until recently).
I have a system set up for the entity's and they function like GM objects.
I just need to get the graphics side working.
--
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.