|
|
Sprite Animation
#260851
04/14/09 06:59
04/14/09 06:59
|
Joined: Apr 2009
Posts: 248 Philippines
seecah
OP
Member
|
OP
Member
Joined: Apr 2009
Posts: 248
Philippines
|
I've read from the tutorial that it's possible to animate the sprite with a series of frames. On the tutorial it uses ent_create in creating the object..
action explosion() { my.ambient = 100; my.flags |= BRIGHT; while(1) { while (!key_e) wait (1); for (my.frame=0; my.frame<12; my.frame += 3 * time_step) wait (1); } }
Is it possible to use pan_create for this instead of ent_create? what can we use instead of my.frame??
Can't is not an option™
|
|
|
Re: Sprite Animation
[Re: delinkx]
#260862
04/14/09 08:01
04/14/09 08:01
|
Joined: Apr 2009
Posts: 248 Philippines
seecah
OP
Member
|
OP
Member
Joined: Apr 2009
Posts: 248
Philippines
|
I'm developing a pure 2d game, I use panels for all the contents.. it is specifically a ricochet (ball bouncing) like game but it's pure 2d.. all the balls, the catcher and bricks are wrap in panels..
I just want to make an animated explosive effect when the brick is broken..
Can't is not an option™
|
|
|
Re: Sprite Animation
[Re: delinkx]
#260870
04/14/09 09:00
04/14/09 09:00
|
Joined: Apr 2009
Posts: 248 Philippines
seecah
OP
Member
|
OP
Member
Joined: Apr 2009
Posts: 248
Philippines
|
Thanks.. I just don't want to load any level to my game. If I'll be going to use panels, how can I animate them? any clue?
Can't is not an option™
|
|
|
Re: Sprite Animation
[Re: delinkx]
#260980
04/15/09 03:10
04/15/09 03:10
|
Joined: Apr 2009
Posts: 248 Philippines
seecah
OP
Member
|
OP
Member
Joined: Apr 2009
Posts: 248
Philippines
|
I've tried to use ent_create to have an explosion working with 11 frames tga file. but now my problem is I can't change the x and y position of the explosion, it stays at 1 position where it originated.
I've tried to load level at main function and call ent_create at other function that traps the panel collisions but the position of the animated sprite doesn't change even if I'll feed variable x and y position to it..
ent_create("explo+11.tga", vector(xPos, yPos, 0), explosion);
where xPos and yPos is variable accroding the to position of the brick being broken..
Can't is not an option™
|
|
|
Re: Sprite Animation
[Re: seecah]
#260990
04/15/09 06:37
04/15/09 06:37
|
Joined: Jul 2008
Posts: 553 Singapore
delinkx
User
|
User
Joined: Jul 2008
Posts: 553
Singapore
|
when u create it, it is created at position (xPos,yPos,0), then even if the xPos and yPos values changes, it wont change. u need to change the value of the entity's position. see the example:
ENTITY* sprite_anim;
sprite_anim = ent_create("explo+11.tga", vector(x, y, 0), explosion);
Now to move the sprite u need to modify the x and y of the entity and also other physical properties e.g:
while(animation)
{
sprite_anim.x += 10;
sprite_anim.y += 10;
sprite_anim.scale_x *= 0.1;
sprite_anim.scale_y *= 0.1;
sprite_anim.roll += 10;
sprite_anim.tilt += 10;
sprite_anim.pan += 10;
sprite_anim.alpha -= 20;
wait(1);
}
This will animate the sprite in someway. u play around with the values and this should be fine.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|