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 / animating colonel-x.x and moving him at same time

Author
Message
acurrate eye
15
Years of Service
User Offline
Joined: 28th Aug 2009
Location: ur house under your pillow was under bed
Posted: 23rd Sep 2009 00:19
i know nobody likes give me da code posts but i make colonel move but not run he just moves away but he doesnt animate this is the code im using

if(dbUpKey()==1)
{
dbMoveObject(1,5);
dbPlayObject(1,300,318);
dbLoopObject(1,300,318);
}
[/quote] does anyone know what im doing wrong? ive been trying for 3 days to get it

kyle
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 23rd Sep 2009 01:40
It might have something to do with the fact that you have both dbPlayObject and dbLoopObject. So try removing one of them then testing it.

Games are like life, they should never stand still.
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 23rd Sep 2009 03:59
The reason is that each time you press the up key, you are starting the animation over again, you need to seperate the animation handling from the movement. To put it simply, your character is getting stuck on the first frame of animation over and over, you are not giving it a chance to play the animation through as each time the program detects a keypress it will reset the animation.

If it ain't broke.... DONT FIX IT !!!
SFCBias
15
Years of Service
User Offline
Joined: 8th Aug 2009
Location: Hephzibah, GA, USA
Posted: 24th Sep 2009 00:40
i suggest you use somthing like this


Then somewhere else in your loop
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 24th Sep 2009 05:05
Or you could simply do:


This will accomplish the same thing as SFCBias's code without the extra variable, but if you use his code it could have advantages when adding other features to your character's gameplay. (checking when the player can jump or crouch for example)

Games are like life, they should never stand still.
acurrate eye
15
Years of Service
User Offline
Joined: 28th Aug 2009
Location: ur house under your pillow was under bed
Posted: 25th Sep 2009 22:57
thanks everyone i found it out it was somewhat harder than u put on i dont have internet is why it took me here is the code i used

if(dbUpKey()==1)
{
dbMoveObject(1,5);
dbLoopObject(1,300,318);
}
if(dbDownKey()==1)
{
dbMoveObject(1,-5);
dbLoopObject(1,300,318);
}

if(dbUpKey()==0) if(dbDownKey()==0)
{
dbLoopObject(1,210,232);
}
[/quote] this is what i used and it works as you see there is more than one way to do it for those who need help with what you may need

kyle
SFCBias
15
Years of Service
User Offline
Joined: 8th Aug 2009
Location: Hephzibah, GA, USA
Posted: 25th Sep 2009 23:02
if it works thats great but looking at that code it seems it would just continue to loop even after you have stopped pressing the button.
acurrate eye
15
Years of Service
User Offline
Joined: 28th Aug 2009
Location: ur house under your pillow was under bed
Posted: 25th Sep 2009 23:20 Edited at: 29th Sep 2009 00:41
thanks im thinking on changing it because its less code

kyle
acurrate eye
15
Years of Service
User Offline
Joined: 28th Aug 2009
Location: ur house under your pillow was under bed
Posted: 25th Sep 2009 23:22 Edited at: 29th Sep 2009 00:41
ok collision is on

kyle

Login to post a reply

Server time is: 2024-11-19 06:03:07
Your offset time is: 2024-11-19 06:03:07