question using change image instead of spawning image
so in my game I'm creating a boss... now the boss is sitting down and i purposely made the images the same size so that i can just use a change image behavior instead of a spawning image behavior (for performance reasons) but the thing thats wrong with my boss character is that it will change images for a while and then shortly thereafter it will just stop and go back to the original image and not change the image anymore... here are the rules that i have placed...
i have made one integer attribute that i have created labeled "attack"
RULE 1:
when attribute self.attack = 0
change image to df normal (which is the default image that i want the boss to have)
-every random 1,3 seconds change attribute self.attack to random 1.4
RULE 2:
when attribute self attack =1
change image to df attack 1
after 5 seconds change attribute self.attack to 0
RULE 3:
when attribute self attack =2
change image to df attack 1=2
after 5 seconds change attribute self.attack to 0
RULE 4:
when attribute self attack =3
change image to df attack 3
after 5 seconds change attribute self.attack to 0
RULE 5:
when attribute self attack =4
change image to df attack 4
after 5 seconds change attribute self.attack to 0
NOW ALL OF THESE RULES HAVE RUN TO COMPLETION CHECKED (whatever that means) AND IT SEEMS TO HAVE HELPED but it only last for a little bit and its stuck back at the default image.
i have made one integer attribute that i have created labeled "attack"
RULE 1:
when attribute self.attack = 0
change image to df normal (which is the default image that i want the boss to have)
-every random 1,3 seconds change attribute self.attack to random 1.4
RULE 2:
when attribute self attack =1
change image to df attack 1
after 5 seconds change attribute self.attack to 0
RULE 3:
when attribute self attack =2
change image to df attack 1=2
after 5 seconds change attribute self.attack to 0
RULE 4:
when attribute self attack =3
change image to df attack 3
after 5 seconds change attribute self.attack to 0
RULE 5:
when attribute self attack =4
change image to df attack 4
after 5 seconds change attribute self.attack to 0
NOW ALL OF THESE RULES HAVE RUN TO COMPLETION CHECKED (whatever that means) AND IT SEEMS TO HAVE HELPED but it only last for a little bit and its stuck back at the default image.
Answers
use Interpolate behavior … rather than timers
===
1st add a Table
4 rows (Text) … 1 column
list the image names for attackImages: dfAttack1; dfAttack2; etc. … in the rows
add an actorAttribute: index type … timeInterval
Rule: when
Attribute: self.timeInterval = 0
-changeAttribute: self.image To: dfNormal
-Interpolate: self.timeInterval To: 5 Duration: random(1,3)
Rule: when
Attribute: self.timeInterval = 5
-changeAttribute: self.image To: tableCellValue(yourTable,random(1,4),1)
-Interpolate: self.timeInterval To: 0 Duration: 5
and the computer doesn't much care about that it just busily does what you tell it to do …
tables are easy
… they are just information/data in cells that is referenced by its row and column position
ah, but, what a difference that makes in speeding up our programming!
… making a 1 column 4 row table is a good place to start!
good to put a Note behavior in your actor … and write
when: this happens
what: do this
I still add notes for complicated behaviors … keeps me focused!
demo of the previous table/rules: http://www.mediafire.com/?gw7e2ketgnls28k