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.

2D All the way! / get variable value? and animation question

Author
Message
quiz master
15
Years of Service
User Offline
Joined: 4th Jul 2008
Location:
Posted: 4th Jul 2008 12:29
is there a way to get the value of one variable and store it in another variable that will not change when the original value changes?

also how to I make an animation play once and then stop?
flashing snall
18
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 4th Jul 2008 16:30
I think youve overcomplicated it. Just follow along for a sec. A is the original value that will change, and the B is the storage and wont.

A=A
B=A
A=random number

as long as you dont have somthing like that in a loop, then it will work out. If it is a loop, it wont work because B will keep on equalling A. And then loosing what A was originally. So, you have to find a way to only set the value of B at one time.


To play a sprite once, you gotta do somthing with the number of frames and playing. I dont usually use animated sprites, but ill take a look around....

Uh... YOu need to know the total amount of frames, and do somthing like this i guess, i havnt tested this, so I dont know if it will work...

Lets say my animation has 16 frames, its a 4X4



I have no clue if that will work...


This is my WIP, not even ready for a WIP thread yet though.http://smallgroupproductions.com/
quiz master
15
Years of Service
User Offline
Joined: 4th Jul 2008
Location:
Posted: 4th Jul 2008 23:49
Thanks I figured it out!! I just declared the xy location outside of the loop like you said. Then I set a boolean variable to declare whether the explosion was happening or not. I used an if statement to test the boolean. Then I just used another if statement to set the boolean back to no when the sprite was equal to the last frame.

Wooot! The explosion looks rad too!
flashing snall
18
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 5th Jul 2008 18:58
Cool. Im glad you have rad explosions


This is my WIP, not even ready for a WIP thread yet though.http://smallgroupproductions.com/

Login to post a reply

Server time is: 2024-05-04 15:20:35
Your offset time is: 2024-05-04 15:20:35