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 Professional Discussion / Object frame(x) code problem

Author
Message
Rohfl
14
Years of Service
User Offline
Joined: 3rd Jan 2012
Location:
Posted: 3rd Jan 2012 07:43
I have a piece of code in my program that is meant to control animations of the main character via variables. This allows me to skip the Play Object command that for some reason doesn't work for my code at all. A continuous Loop Object command controlled by these range variables that change depending on events throughout the program works great. However, I reached this part of the code, and the last if-endif command does not recognize that the object frame has reached the end of that particular animation, which makes the animation loop continuously without resetting the variable controlling it. Here's the snippet, and a quick legend to explain a few things:

Legend:

Object 1 is the character animated with a sword sheathed.
Object 4 is the character animated with a sword unsheathed.
The unsheathing animation is split into the two different objects' animation; one with the character reaching for the sword (Object 1), and the other pulling the sword out(Object 4).



Please Help!

Wo!
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 3rd Jan 2012 22:27
Based on what is shown, the animations will continue because the loop object commands have no conditions, or parameters that change. When your animation reaches the last frame; the variables Unshea1 & Unshea2 are set to zero; and that is it really. Perhaps the loop object commands should sit in the If blocks.

One thing; the Loop Object command requires all parameters to be integer; rather than floats. (EG: Without the # suffix) - It will work, but the CPU has a little more work to do converting floats to integers every loop.

Rohfl
14
Years of Service
User Offline
Joined: 3rd Jan 2012
Location:
Posted: 4th Jan 2012 00:45
Well the conditions are embedded within the rest of the code. Say for exaple the attack animation code goes:



I should mention that the unshea1 action works just fine. It's just the Unshea2 action that doesn't recognize when the frame Reaches the range that sets it back to "0".

P.S. Thanks for the variable type note! I had no idea that the CPU had to convert variable types. That actually solved another problem I was having!

Wo!
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 4th Jan 2012 20:25
No problem.

Quote: "the conditions are embedded within the rest of the code"


The animation will still loop if the 'Loop Object' command is called; The 'Stop Object' command will only stop the object until the next Loop/Play Object command. Maybe I am missing something.

Anyway, I'm not sure why one works and not the other; unless frame 40 doesn't exist.

MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 4th Jan 2012 20:59
Interesting... just tagging in guys

Rohfl
14
Years of Service
User Offline
Joined: 3rd Jan 2012
Location:
Posted: 5th Jan 2012 19:58
Fixed it! turns out the sync rate was too low and the animation speed was too high, so a shorter animation was pretty much looping and never hitting the indicated frame for some reason. Made animation longer and increased the range.

Wo!

Login to post a reply

Server time is: 2026-07-09 20:56:00
Your offset time is: 2026-07-09 20:56:00