question using change image instead of spawning image

digitalzerodigitalzero Member, BASIC Posts: 639
edited June 2012 in Working with GS (Mac)
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.

Answers

  • MotherHooseMotherHoose Member Posts: 2,456
    use changeAttribute: self.Image … rather than changeImage behavior
    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

    image MH
  • digitalzerodigitalzero Member, BASIC Posts: 639
    i.have.absolutely.no.idea.what.this.means LOL none whatsoever... I've never used tables before so thats definitely new to me... @motherhoose thanks for always replying to my messages on the forum but I'm so new to this its ridiculous... i have managed to get a lot of things done with the stuff that i have created but there are so many methods of doing things i just can't wrap my mind around it... its like i constantly have a brain fart -______-
  • MotherHooseMotherHoose Member Posts: 2,456
    @digitalzero … the confusion comes from you having such a neat and orderly mind!
    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

    image MH
  • MotherHooseMotherHoose Member Posts: 2,456
    @digitalzero … message in your Inbox at top of page

    image MH
  • digitalzerodigitalzero Member, BASIC Posts: 639
    @motherhoose... i have sent you a message please check it
Sign In or Register to comment.