Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
4 registered members (AndrewAMD, fogman, Grant, juanex), 972 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Sprite Animation #260851
04/14/09 06:59
04/14/09 06:59
Joined: Apr 2009
Posts: 248
Philippines
seecah Offline OP
Member
seecah  Offline 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: seecah] #260860
04/14/09 07:57
04/14/09 07:57
Joined: Jul 2008
Posts: 553
Singapore
delinkx Offline
User
delinkx  Offline
User

Joined: Jul 2008
Posts: 553
Singapore
y u dont want to use ent_create ?

thats the way to do it easier. once u create the entity, u can assign the action to it.

and the sprites has animation frames with it. so we access each frame by my.frame here.

if u use pan_create only one bitmap/frame will be loaded.


A7 commercial Team / VC++ 2008 Pro
homepage | twitter | facebook
Re: Sprite Animation [Re: delinkx] #260862
04/14/09 08:01
04/14/09 08:01
Joined: Apr 2009
Posts: 248
Philippines
seecah Offline OP
Member
seecah  Offline 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: seecah] #260869
04/14/09 08:55
04/14/09 08:55
Joined: Jul 2008
Posts: 553
Singapore
delinkx Offline
User
delinkx  Offline
User

Joined: Jul 2008
Posts: 553
Singapore
ok. u can still use the ent_create for 2D animation. since sprite is 2D itself.

if u use panel, u will need to create the animation urself.


A7 commercial Team / VC++ 2008 Pro
homepage | twitter | facebook
Re: Sprite Animation [Re: delinkx] #260870
04/14/09 09:00
04/14/09 09:00
Joined: Apr 2009
Posts: 248
Philippines
seecah Offline OP
Member
seecah  Offline 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: seecah] #260871
04/14/09 09:08
04/14/09 09:08
Joined: Jul 2008
Posts: 553
Singapore
delinkx Offline
User
delinkx  Offline
User

Joined: Jul 2008
Posts: 553
Singapore
ent_create doesnt load level. but yes u need load a level before using ent_create. u can use an empty level also.

as for animating panel, u need to play with the x, y, alpha values to create ur animation. u can look arnd on the forum, there have been demos of game using only panel including collision.


A7 commercial Team / VC++ 2008 Pro
homepage | twitter | facebook
Re: Sprite Animation [Re: delinkx] #260980
04/15/09 03:10
04/15/09 03:10
Joined: Apr 2009
Posts: 248
Philippines
seecah Offline OP
Member
seecah  Offline 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 Offline
User
delinkx  Offline
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:

Code:
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:

Code:
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.


A7 commercial Team / VC++ 2008 Pro
homepage | twitter | facebook
Re: Sprite Animation [Re: delinkx] #261075
04/15/09 15:34
04/15/09 15:34
Joined: Apr 2009
Posts: 2
I
igorasdf Offline
Guest
igorasdf  Offline
Guest
I

Joined: Apr 2009
Posts: 2
#include <acknex.h>
#include <default.c>


void main()
{

fps_max = 40; // limit the frame rate to 40 fps
video_mode = 8; // run at 1024 x 768 pixels
video_depth = 32; // 32 bit mode
// video_screen = 1; // start in full screen mode
//level_load(NULL);
//wait(5);

}

ENTITY* sprite_anim;

sprite_anim = ent_create("explo+5.tga", vector(200, 200, 0), NULL);

action test()
{
sprite_anim.scale_x = -1;
}





function move_startup()
{
test();
}

what is wrong here???

plz help!

Re: Sprite Animation [Re: igorasdf] #261077
04/15/09 16:06
04/15/09 16:06
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
use ent_animate to animate the sprite...


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Page 1 of 2 1 2

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1