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 / 2 questions

Author
Message
tomtetlaw
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location:
Posted: 4th Jul 2009 18:28
1) How come my animations won't load, I've been trying to fix them for 2 days, I've posted numerous threads, and I've tried many different solutions but none have worked. ??

2) How would I be able to set PLAYER to PLAYER_IDLE when no other keys are pressed?

Heres my code:



#ifdef _in_programming_heaven_
MakeAnAwesomeGame(lots of badies, lots of guns, lots of stuff to do, BIG level)
#endif
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 4th Jul 2009 18:47
You are using the Appendobject command incorrectly....

where you have in that command : PLAYER_IDLE . you should have a number that is a reference to an Object ID that you are appending the animation TO(in this case: PLAYER), the parameter After PLAYER_IDLE, should be a frame number for which frame in the destination object you want to append too.

If it ain't broke.... DONT FIX IT !!!
tomtetlaw
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location:
Posted: 4th Jul 2009 19:03
So objects cant have more then one animation?

#ifdef _in_programming_heaven_
MakeAnAwesomeGame(lots of badies, lots of guns, lots of stuff to do, BIG level)
#endif
tomtetlaw
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location:
Posted: 4th Jul 2009 19:04
If that is so, then how will I do this:



#ifdef _in_programming_heaven_
MakeAnAwesomeGame(lots of badies, lots of guns, lots of stuff to do, BIG level)
#endif
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 4th Jul 2009 19:25 Edited at: 4th Jul 2009 19:26
Well I never tested this, but looking at the help of the dbAppendObject command, the second parameter is the object number and the third is the frame, and I'm pretty sure you have to append always to the SAME object number, otherwise you end up with different objects or nothing at all. So try this:



(I have no more ideas if this doesn't work.)

Quote: "How would I be able to set PLAYER to PLAYER_IDLE when no other keys are pressed?"


For example like this:

Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 4th Jul 2009 19:32
P.S. I just noticed something else. You use the variable PLAYER as an object ID number, and then you try to change that number according to the player state? This won't work! If you want to play a different animation for each movement, then you have to use the dbPlayObject command with different start and end frames, you don't change the object number. And if you want a variable to keep track of the current state of the player, then define an other variable in addition to PLAYER.
tomtetlaw
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location:
Posted: 4th Jul 2009 19:44
OMG It still doesn't work.....



#ifdef _in_programming_heaven_
MakeAnAwesomeGame(lots of badies, lots of guns, lots of stuff to do, BIG level)
#endif
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 4th Jul 2009 20:30 Edited at: 4th Jul 2009 20:31
this how we use append object in basic.



modify the above to work in DGK.

Dark Physics makes any hot drink go cold.
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 4th Jul 2009 20:40
Now the only problem I see is that the dbLoopObject probably restarts the animation from the first frame every loop, so it doesn't get very far in playing it...

First of all, make sure that the animations are really properly loaded this time. (Just to exclude sources of error.) Either step through the code in the debugger or print the values of your player_attack and player_move variables to the screen. Do they show acceptable numbers? It would be good to define a third variable too, which shows the total number of frames after the last animation is loaded too (like player_end) and check that also. You will need to know the end frame when playing the animation.

For TESTING only, you can also try to comment out the dbLoopObject from the main loop, and insert dbLoopObject(PLAYER) just before the while(LoopGDK()) line. If everything is loaded all right, you should see all the animations looping through the whole sequence.

If it's OK so far, then you can get to the point of changing the animations. The catch here is that you have to detect when the animation should CHANGE. If you call dbLoopObject or dbPlayObject every frame, it will always go back to the beginning frame which is not very useful.

How you detect change is up to your coding method, but I suggest storing the previous state of the player in a variable, then determine the new state according to the keypresses, and compare the two. Quick example:



Of course the WALKING and IDLE are constants containing some numbers. The dbSetObjectFrame is needed to make sure that the animation starts from the new starting frame and does not loop through any other frames in between.

Something like this... This is not the complete code but I hope it helps to set you on track.

Login to post a reply

Server time is: 2024-10-01 05:52:33
Your offset time is: 2024-10-01 05:52:33