Sprite Animation
#1
Posted 23 April 2012 - 10:21 AM
In my game, when vitality <1 the sprite changes to a spinning shrinking sprite that is supposed to reach a certain image number then destroy.
This works alot of the time but often the sprite will go through the index twice b4 destroying itself.
Has anone else had this problem?
any help would be appreciated.
#2
Posted 23 April 2012 - 10:51 AM
Hi guys.
In my game, when vitality <1 the sprite changes to a spinning shrinking sprite that is supposed to reach a certain image number then destroy.
This works alot of the time but often the sprite will go through the index twice b4 destroying itself.
Has anone else had this problem?
any help would be appreciated.
What do you have the image_speed set as? If you have a number greater than 1, the image_index may skip certain sub images and hence it may take two animation cycles to actually equal the image_index number that you want to destroy on.
Edit: One to many _'s.
Edited by Soulsnatcher, 23 April 2012 - 10:51 AM.
#3
Posted 24 April 2012 - 05:59 AM
speed is .25
destroy > 68 ( i tried diff index numbers)
so .25 should reach an integer every 4th step so any whole number should work right?
when prob does occur,it will go through index very quickly 1st time, then slowly the second time
Edited by RedbacK, 24 April 2012 - 06:01 AM.
#4
Posted 24 April 2012 - 06:57 AM
In the STEP event, you can try if image_index > 71 instance_destroy(); //may have to play with that numberi have image rotate and shrink 72 frames
speed is .25
destroy > 68 ( i tried diff index numbers)
so .25 should reach an integer every 4th step so any whole number should work right?
when prob does occur,it will go through index very quickly 1st time, then slowly the second time
Also, it's weird, but if the above doesn't work on its own, then put the following in the CREATE event:
image_index = 4/4-1; //using fractions allows whole integers for frames
#5
Posted 24 April 2012 - 07:18 AM
then set index to 1 but still happens
also wouldnt i need to set > 70 as the image index fins at 71 not 72 (0-71)
#6
Posted 24 April 2012 - 07:27 AM
i set sprite to 144 frames shrink/720 deg rotate
then set index to 1 but still happens
also wouldnt i need to set > 70 as the image index fins at 71 not 72 (0-71)
You can set the image_index to 1, but the image_speed will determine a continuing animation. When you set the image_index to 1, set the image_speed to 0.
Also, your second sentence is correct. If image_index > 70 {image_index = 1; image_speed = 0; blah blah}.
#7
Posted 24 April 2012 - 10:14 AM
#8
Posted 24 April 2012 - 02:23 PM
#9
Posted 24 April 2012 - 11:21 PM
Im gunna try just shrinking and rotating the current sprite instead of changing sprite, see if that works.....
Edited by RedbacK, 24 April 2012 - 11:22 PM.
#10
Posted 25 April 2012 - 01:15 AM
... Also, quick question: What's the actual code for the effect? It sounds like you have some syntax errors at the root of the problem.
#11
Posted 25 April 2012 - 06:35 AM
Just off the top of my head, it sounds to me like you're overcomplicating things.
1. change sprite to shriveling animation
2. in Animation End Event, check if sprite index is shriveling sprite
3. if it is, then destroy
I hope this helps, $:^ J
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











