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.

Newcomers DBPro Corner / Almost have this animated. Can you help?

Author
Message
Stygian
14
Years of Service
User Offline
Joined: 6th Jan 2010
Location:
Posted: 6th Feb 2010 13:02
So, I think I understand animation for the most part, but the in the code I am about to link I am attempting to display my animated sprite in different frames that change based on player input.

Behind the Sprite I have an image that moves coordinates based on player input as well. IE, you press rightkey and the image moves left to simulate movement, like in simple RPGs.

You can assume that I used GET IMAGE and LOAD IMAGE for everything correctly, because I see everything I need to see. Something isn't working correctly because there is still a blue flicker, and the char displays animation frames erratically.

LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 6th Feb 2010 19:42
You only need the sync at the end of your do - loop. Try removing the extra syncs and see if that takes care of it.

Stygian
14
Years of Service
User Offline
Joined: 6th Jan 2010
Location:
Posted: 8th Feb 2010 07:10 Edited at: 8th Feb 2010 07:21
Whats wrong with this loop? Im just trying to simply animate a section of the image based on what direction you press. I am trying to simplify it in order to better understand the process. I have a feeling the duration of the looping animation is doing something weird.

LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 8th Feb 2010 16:07
You tell it to play the animation for when the downkey is pressed every loop. I would take this out. Secondly, you need to put in a delay between keypresses so that you can see the entire animation. Delaying it by 200ms should work. Like this:



Stygian
14
Years of Service
User Offline
Joined: 6th Jan 2010
Location:
Posted: 11th Feb 2010 20:59 Edited at: 11th Feb 2010 21:14
That doesnt seem to work still. Theres a delay between button presses. As in you have to press up twice before the right animation plays. The first time I press a button it works fine. It seems as if the delay is caused by my delay set by the PLAY SPRITE. Is that possible?

There has to be some code out there where some one has a Final Fantasy 1 or a Dragon Warrior clone working.

Are there better loops to use? Should I be asking for an inkey$ or something?

jfroco
14
Years of Service
User Offline
Joined: 1st Dec 2009
Location: Chile
Posted: 12th Feb 2010 02:41
Hi Stygian,

Does this work?





Media is attached.

Attachments

Login to view attachments
Stygian
14
Years of Service
User Offline
Joined: 6th Jan 2010
Location:
Posted: 16th Feb 2010 02:01 Edited at: 16th Feb 2010 02:02
Thanks to both of you for trying to help me out. This was a learning experience about SPRITE FRAMEs and the use of SELECT KEY. I ended up utilizing some of Jfroco's code to make my char move correctly. It was really cool of you to share your knowledge!
jfroco
14
Years of Service
User Offline
Joined: 1st Dec 2009
Location: Chile
Posted: 16th Feb 2010 19:10
Hi Stygian,

Excellent! Good luck with your project.

Best regards

JF

Login to post a reply

Server time is: 2024-09-28 14:22:01
Your offset time is: 2024-09-28 14:22:01