How to save the new image after changed image?

Hi,

I want my actor to change color when it reach a score of 10. And then I want it to save the new color, so that if you die it will restart with the new color. Like untill you have reached a score of 10 the actor will be green and after you have reached a score of 10 once the charater will allways be red instead.

This is how far I have come:
"IF" Game.Score = 10
"DO" change attribute - Self.Image to Red.Character(from Media)
Save attribute - XXX as YYY

Since I can't change the XXX to Red.Character, I guess this is the wrong way to do it, so please help me!

Thank you!

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    Since I can't change the XXX to Red.Character, I guess this is the wrong way to do it, so please help me!
    Use a 'text' attribute.
  • Use a 'text' attribute.
    Okay, I've tried to use a "Text" attribute to get the text "Red.Character" into the rule, that went well. But the rule still doesn't save the new color when the actor "dies" and respawns. Do you have any idea about what's wrong?

    Thank you!

  • SocksSocks London, UK.Member Posts: 12,822
    edited March 2014
    Okay, I've tried to use a "Text" attribute to get the text "Red.Character" into the rule, that went well.
    I thought you wanted the save the name of the current image assigned to the actor (to 'save' it) into an attribute ?

    If that's the case all you need to do is:

    Change 'Current Image' to self.image

    ('Current Image' is a text attribute)
    But the rule still doesn't save the new color when the actor "dies" and respawns. Do you have any idea about what's wrong?
    I don't know what you mean when you refer to 'the rule' ?
  • Okay, I've tried to use a "Text" attribute to get the text "Red.Character" into the rule, that went well.
    I thought you wanted the save the name of the current image assigned to the actor (to 'save' it) into an attribute ?

    If that's the case all you need to do is:

    Change 'Current Image' to self.image

    ('Current Image' is a text attribute)
    But the rule still doesn't save the new color when the actor "dies" and respawns. Do you have any idea about what's wrong?
    I don't know what you mean when you refer to 'the rule' ?
    You'll have to excuse my ignorance, I've only used GameSalad for a week. Let me try to explain what I'm asking for with an example. There's a game called "Jumpy Jack", in this game you get a new "garments" (shirt, pants, etc.) every time you hit a certain point, for example the character receives a new sweater the first time you get 8 points. If you then die you still have this shirt on when you start up again. What I'm asking is how to get the actor to act this way?
  • SocksSocks London, UK.Member Posts: 12,822
    Okay, I've tried to use a "Text" attribute to get the text "Red.Character" into the rule, that went well.
    I thought you wanted the save the name of the current image assigned to the actor (to 'save' it) into an attribute ?

    If that's the case all you need to do is:

    Change 'Current Image' to self.image

    ('Current Image' is a text attribute)
    But the rule still doesn't save the new color when the actor "dies" and respawns. Do you have any idea about what's wrong?
    I don't know what you mean when you refer to 'the rule' ?
    You'll have to excuse my ignorance, I've only used GameSalad for a week. Let me try to explain what I'm asking for with an example. There's a game called "Jumpy Jack", in this game you get a new "garments" (shirt, pants, etc.) every time you hit a certain point, for example the character receives a new sweater the first time you get 8 points. If you then die you still have this shirt on when you start up again. What I'm asking is how to get the actor to act this way?
    There's probably hundreds of ways to achieve this sort of thing so it's difficult to offer any advice without knowing exactly how your particular game works.

    My first question would be what is it that is removing these rewards ? I presume the way you have this set up is that you are using some kind of system where these rewards are achieved but then are somehow removed when you die/start again ?
  • @Socks said:

    There's probably hundreds of ways to achieve this sort of thing so it's difficult to offer any advice without knowing exactly how your particular game works.

    My first question would be what is it that is removing these rewards ? I presume the way you have this set up is that you are using some kind of system where these rewards are achieved but then are somehow removed when you die/start again ?

    I managed to figure it out! By creating an "integer" attribute, which increased through the highscore. And then the image is decided by the number of the attribute. Thanks for the help!

    However, I have encountered a new problem. The game that I am working on is a "never ending game", where it spawns platforms after a random equation (random (-20) -20). The problem is that it sometimes happens that there are several platforms which spawns over each other in a row, leading to the platforms continues to spawn outside the game. Do you know how to solve this?

    Thank you!

  • SocksSocks London, UK.Member Posts: 12,822
    edited March 2014

    @eric_berg_92@hotmail.com said:
    Do you know how to solve this?

    You've not supplied any information about how you have your rules set up, all we have to go on is that something gets spawned using "(random (-20) -20)" (?), and the result is that "leading to the platforms continues to spawn outside the game".

    ?

    I'm not sure what kind of input you are looking for beyond some random-ish guesses ?

  • @Socks said:
    I'm not sure what kind of input you are looking for beyond some random-ish guesses ?

    @Socks said:
    I'm not sure what kind of input you are looking for beyond some random-ish guesses ?

    I belive the easist way to give you all that information is by giving you this link:

    youtube.com/watch?v=AF47UYgMNnA

    I've used that guid for the base rules. At 11:50 you see what I mean with the random commando. But with those rules the platforms still can spawn outside the map, so what do I have to add to get some sort of rule that tells them to spawn at max 320 pixlar and min 0 pixlar?

    Thank you!

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

    If only the random commando were here to destroy this problem! (Sorry, couldn't resist...)

    In @jamie_c‌'s video, he suggested spawning a new platform at random(-20,20) y position, relative to the actor (another platform). So that spawns a new actor somewhere within 20 pixels of the current platform actor, at the edge of the screen (because that's where the platform actor starts and the x position is set to 0 relative to actor).

    Is the problem you're having that after a certain amount of time, the platforms end up spawning too high or low?

    I haven't watched the entire video... does he talk about how to keep the platforms within the scene boundaries?

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

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    edited March 2014

    Thanks for the tag @tataing.

    @eric_berg_92@hotmail.com, they shouldn't spawn over each other. In the tutorial linked I have set up an Attribute called spawned that allow each platform to only spawn 1 copy. Have you done this?

    Also I see in your comment above you have written the random code as (random (-20) -20) it should actually be random(-20,20) so the platforms can spawn anywhere from 20 pixels below or above the current platform.

    You are able to download my source code from my website and compare my code to yours, that might help you find the error(s). My website is linked in my signature below.

  • @tatiang said:
    If only the random commando were here to destroy this problem! (Sorry, couldn't resist...)

    In jamie_c‌'s video, he suggested spawning a new platform at random(-20,20) y position, relative to the actor (another platform). So that spawns a new actor somewhere within 20 pixels of the current platform actor, at the edge of the screen (because that's where the platform actor starts and the x position is set to 0 relative to actor).

    Is the problem you're having that after a certain amount of time, the platforms end up spawning too high or low?

    I haven't watched the entire video... does he talk about how to keep the platforms within the scene boundaries?

    Haha, my english is pretty bad but as long as you help me I'll let you joke about it ;) But anyway, it's exactly the problem I have! That if the platform spawns +20 pixels a few times in a row it ends up off screen.

  • @jamie_c said:
    Thanks for the tag tataing.

    eric_berg_92@hotmail.com, they shouldn't spawn over each other. In the tutorial linked I have set up an Attribute called spawned that allow each platform to only spawn 1 copy. Have you done this?

    Also I see in your comment above you have written the random code as (random (-20) -20) it should actually be random(-20,20) so the platforms can spawn anywhere from 20 pixels below or above the current platform.

    You are able to download my source code from my website and compare my code to yours, that might help you find the error(s). My website is linked in my signature below.

    Thank you for the youtube video! And yes, I have used all your rules, but my problem is that with the "random (-20,20) there's still a small chance that the platforms spawns +20 pixels a few times in a row it ends up off screen. Do you know what to do about this?

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    Oh now I understand. You're right I have not accounted for that in the tutorial, the platforms can certainly move off the top or bottom of the screen.

    What you'll have to do is add in a rule that checks the Y location of your platform, if it is above the top of the screen or below the bottom, choose a new Y location within the screen bounds.

Sign In or Register to comment.