Random Images Are Blank/White in Preview

Hey- I am working on a very simple app where I have an Image/Actor that takes up the fullscreen and every time the image/actor is pressed i want it to change the image to another random image (i have 280 images loaded into my game).

So, I have a Rule set up when Actor receives event touch is pressed to change the self.Image to "image"..random(1000,1280)
I also have a Display Text set to self.image

When i preview the app the Actor's Image changes to a white box and the display text changes every time i click from "1000" (which is the filename of the first image) to "image x" x being the random number selected.

What's the deal? :neutral:

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    edited April 2015

    Are your images called . . .

    image1001
    image1002
    image1003

    . . . . etc ?

    Or are they called . . .

    1001
    1002
    1003

    . . . . etc ?

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

    Make sure your image filenames match your change attribute expression. If your filenames are of the format image1000.png and your expression is of the format image1000 then it should work.

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

  • digitaldividedigitaldivide Member Posts: 3

    Hey- Thanks for the speedy reply!

    My images are named 1001, 1002, etc. Not image1001, image1002, image... they are all .png inside game salad and .jpgs in the folder i have them saved in. They are saved @ 512x512. I'm not sure if any of this matters.

    I have tried changing my Change Attribute from
    self.image to "image"..random(1000,1280) --> which gives me the white box with the random Text Display "image1xxx" (the xxx being the random # selected)

    to

    self.image to "self.image"..random(1000,1280) -->but this gives me a white box with random Text Display "self.image1xxx" (the xxx being the random # selected)

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

    If your images are named 1001, 1002, etc., then you shouldn't be concatenating the word "image" onto the front of your self.Image attribute. The self.Image attribute is tied to the exact filename of the image in your Library. It's looking for files called image1001, image1002, etc. and not finding them. Just remove "image".. from your expression:

    Change Attribute self.Image to random(1000,1280).

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

  • SocksSocks London, UK.Member Posts: 12,822

    @digitaldivide said:
    My images are named 1001, 1002, etc

    Like tatiang says, your images are called '1001' '1002' '1003' (etc) but you are telling GameSalad to look for images called 'image001' 'image002' 'image003' (etc), and as there are no images with that name then GameSalad can find no image to display, which results in the blank actor you are seeing.

  • digitaldividedigitaldivide Member Posts: 3

    Thanks! ur the man, dog! B)

Sign In or Register to comment.