Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / "Simple" Animated Sprite error

Author
Message
Ninja_Je5us
14
Years of Service
User Offline
Joined: 1st Feb 2010
Location:
Posted: 30th Mar 2011 14:00
Hi all,

I am working on designing an RPG game with my designers and animators and am currently trying to make a prototype using sprites from the handheld pokemon games.

I am however having what seems like a ridiculous problem using an animated sprite.

The setup for the sprite is successful using the simple dbCreateAnimatedSprite() code:



I get a weird error when using dbPlaySprite() assigned to the up and down keys. Here's the code for that:



The code for the down key works perfectly. The sprite loops from frame one to three and moves in the direction that I wanted.

The problem comes when pressing the up key. It seems to start at 1 and scroll all the way to nine before looping from 7 to 9. Is there any way to make it just start from 7 on the press of the up key?

Rob
Ninja_Je5us
14
Years of Service
User Offline
Joined: 1st Feb 2010
Location:
Posted: 30th Mar 2011 15:32
Sorry, another thing I can't figure out is how to make the sprite move right or left.

Obviously I could rotate sprite by 90 degrees positive or negative and tell it to move, however I have animations specifically for moving right and left, so if I rotate the sprite the image will also be rotated.
Pilz X Schizo
17
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Massachusetts, USA
Posted: 30th Mar 2011 19:11 Edited at: 30th Mar 2011 19:24
You basicly need to set the frame you want it to start on befor playing the frames. Can't remeber the code off the top of my head, but there should be a dbSetSpriteFrame command (or similar).

Now for moving left and right, just rotate by 90, move, and then rotate back to 0.

NOTE: You will have to keep track of your current direction and check befor setting the start frame if it is different, otherwise you'll always be setting it to the start frame and it won't animate.


EDIT: Figured I would give a quick example in case it wasn't very clear what I am explaining. I don't have the documentation handy so the db Commands may need to be checked.



Login to post a reply

Server time is: 2024-11-19 12:19:05
Your offset time is: 2024-11-19 12:19:05