Is there an easier way?

crazyfishdevcrazyfishdev Member Posts: 283
edited November -1 in Working with GS (Mac)
Hello again and Happy Thanksgiving!

I went missing from the game salad community (the best community on the web) for around 6 months but finally have the time again to begin my work.

Ok, so I'm working on a game and I have this ball that I would like to be different colors when something is pressed.

Here is the code I am using

image

Is there an easier way to do it? and if so would any of you mind sharing?

Comments

  • cbtcbt Member Posts: 644
    Can't see the code you are using..
  • applaudmobileapplaudmobile Member Posts: 208
    Your code image isn't showing up
  • crazyfishdevcrazyfishdev Member Posts: 283
    fixed :) and also I forgot to mention I'm doing this for 10 different images
  • applaudmobileapplaudmobile Member Posts: 208
    Yes you could name the images "ball1.png" "ball2.png" etc

    and then use change attribute instead of change image and set the image name attribute to "ball"..game.ball..".png"
  • VoidedSkyVoidedSky Member Posts: 1,095
    Just looked at your image, and you can do this:

    Name your images 1, 2, and 3. (.png)

    and then do this:

    `
    Load Attribute "game.ball" Attribute "game.ball#"

    Change Attribute "self.image" to (game.ball#..".png")
    `
    (do not use parenthesis, but use the two dots, and the quotes, and the .png)

    This should do the trick...
    If you want it to constantly check, you can use constrain, or a timer, or put it in some sort of rule, but how it is right now, it will change the image as soon as it loads.

    Hope this helps!!!
    Happy Thanksgiving!

    ~CTM
  • cbtcbt Member Posts: 644
    Well... Don't really get how is the code you are using have anything to do with color changing :D but you can use

    change attribute;
    self.color --> R/G/B

    Just make the original image as white as you can and use change attribute to change its color..
  • crazyfishdevcrazyfishdev Member Posts: 283
    Is the change Attribute any better than change image or do they take the same amount of computing power?
  • applaudmobileapplaudmobile Member Posts: 208
    you can't make up the image name like I've shown with change image so it wouldn't work. only works with change attribute
  • VoidedSkyVoidedSky Member Posts: 1,095
    Change Attribute takes less processor power than change image.

    ~CTM
  • crazyfishdevcrazyfishdev Member Posts: 283
    thanks so much all and to reply to CBT its actually changing images not color, sorry.
  • crazyfishdevcrazyfishdev Member Posts: 283
    Alright thank you very much :) time to go change my code :) happy thanksgiving all!
  • cbtcbt Member Posts: 644
    crazyfishdev said:
    thanks so much all and to reply to CBT its actually changing images not color, sorry.

    If you are changing the image for only to change color, use change attribute. It consumes much less memory..
  • LeanneLeanne Member Posts: 168
    change color will also change the smile, though, so i would store the black eyes and white smile and white cheeks as a separate actor and layer it on top, then use change colour for the circle only.
  • MonkeyFaceMonkeyFace Removed Posts: 52
    Can you use the animation behaviour?
  • crazyfishdevcrazyfishdev Member Posts: 283
    Don't think so... animation behavior cycles through them but mine needs an attribute involved.
  • MonkeyFaceMonkeyFace Removed Posts: 52
    why do you need an attribute? You don't need it to cycle over and over again, you can put a timer, or a rule to play the animation.
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    MonkeyFace said:
    why do you need an attribute? You don't need it to cycle over and over again, you can put a timer, or a rule to play the animation.

    He doesnt want a animation. He wants the image to change off an attribute.
  • MonkeyFaceMonkeyFace Removed Posts: 52
    yes, but if you can use an animation, why not use it?
Sign In or Register to comment.