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.

DarkBASIC Discussion / Object Animation in DBC

Author
Message
Mitchell Monhemius
10
Years of Service
User Offline
Joined: 11th Apr 2013
Location:
Posted: 11th Apr 2013 14:36
Hello, i'm having some problems with animation.

Whenever I do this:

if rightkey()=1 then loop object 1,1,10
if rightkey()=0 then loop object 1,11,20

but if I release the key in the middle of the loop, it finishes the loop before it goes to the second loop. I would like it to go to the second loop right away. How do i do this?

thanks in advance,
Mitchell
LBFN
16
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 11th Apr 2013 21:52
Hi, welcome to the DBC forums.

I think you could use the STOP OBJECT command, like this:



You would need to change the object name from "YourObject.x" to the actual name and pathway for your object.

RIGHTKEY() is going to return 1 if the key is pressed and 0 if not, so you should not have to test for it twice. The example I have given shows this.

The code checks to see if the current object frame is within the animation that you want and only resets it when needed. It exits when the spacebar is pressed.

Hope this is helpful.

So many games to code.....so little time.
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 12th Apr 2013 01:01 Edited at: 12th Apr 2013 01:01
@LBFN
I'm still working on an animator for DBC. I usually can only afford an hour or 2 a week with my new schedule so it's taking a while. The DarkNoobs project hasn't been abandoned.

Enjoy your day.
LBFN
16
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 12th Apr 2013 11:01
Hi Latch,

Glad to hear you are still working on the animator. Perhaps things could be scaled back a little on the Farm game since time is at a premium?

So many games to code.....so little time.

Login to post a reply

Server time is: 2024-03-29 09:43:30
Your offset time is: 2024-03-29 09:43:30