Spawn Images for actors

aliz94aliz94 Member, PRO Posts: 19

I have the following:

self.block_id = random(1,4)

but I want to spawn the images in the order 1, 2, 3, 4

How do I do that

Comments

  • opaopa Member Posts: 35
    edited April 2014

    Do you want spawn new actors or just change the image of an actor?

    If you want to change actorr's image, use something like this:

    change self.block_id to self.block_id+1

    When self.block_id = 1 -> change attribute self.image to imagename1

    When self.block_id = 2 -> change attribute self image to imagename2

    Etc..

  • aliz94aliz94 Member, PRO Posts: 19

    @opa said:
    Do you want spawn new actors or just change the image of an actor?

    If you want to change actorr's image, use something like this:

    change self.block_id to self.block_id+1

    When self.block_id = 1 -> change attribute self.image to imagename1

    When self.block_id = 2 -> change attribute self image to imagename2

    Etc..

    Only the image.

    self.block_id+1 isn't valid for some reason it's removed after I preview the app.

    I want the same as random(1,4) except without the random but that doesn't work either. Whats the proper format?

  • opaopa Member Posts: 35

    Is self.block_id integer attribute? When do you want to change the actor's image? Do you want to animate it during time? Image1 -> image2 -> image3 -> image4 -> image1 etc..?

  • aliz94aliz94 Member, PRO Posts: 19

    As the game progresses and the user clicks I want the image to go through a series of images starting from 1-10. Currently is works but only randomly. I want it to go in order.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited April 2014

    @aliz94 said:
    As the game progresses and the user clicks I want the image to go through a series of images starting from 1-10. Currently is works but only randomly. I want it to go in order.

    Then just add one to the attribute each time the user clicks. Get rid of the random function. Also make sure you are selecting attributes from the drop-down menus rather than typing them in (which doesn't work).

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.