changing image

i would like to change between 3 hotdogs one full one half and one small but i don't know how to change the image when you click on it

Comments

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

    When Touch is Pressed change attribute game.imageNumber (integer) to mod(game.imageNumber+1,2). This will cycle between the values 0, 1, and 2.

    Constrain attribute self.Image to game.imageNumber.

    Be sure to name your three images 0.png, 1.png, and 2.png.

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

  • JSprojectJSproject Member Posts: 730
    edited August 2014

    Building upon what tatiang wrote:

    Let’s say that your images are named hotdog0.png, hotdog1.png and hotdog2.png

    replace:
    mod(game.imageNumber+1,2)
    with:
    “hotdog”..mod(game.imageNumber+1,2).

    Doing it this way will allow you to add ketchup too :P

Sign In or Register to comment.