How to save the new image after changed image?
eric_berg_92@hotmail.com
Member Posts: 7
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!
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
Thank you!
If that's the case all you need to do is:
Change 'Current Image' to self.image
('Current Image' is a text attribute)
I don't know what you mean when you refer to 'the rule' ?
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!
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 ?
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!
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
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.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
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.
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?
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.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page