Need help limiting actor reaction to first touch.
lashukla
Member Posts: 3
I have an actor ( egg ) that breaks into two part ( two spawned actor ) upon touch. When the egg opens, a chick comes out. The trouble I am having is that when the chick comes out it retains the earlier behavior of the egg actor and upon touch again spawns two broken shells.
I don't want the chick to spawn the shells again on touch. Any pointers would be helpful.
Thanks.
Regards.
Umesh
Comments
Hi @lashukla, welcome to the forums.
(Firstly, one post would have been enough.)
So, add an integer attribute to your egg actor to keep track of its state - lets call the attribute EggState and set it to 0.
In your touch rule, add the condition "if attribute EggState=0".
When the chick comes out and shells spawn, also set the EggState equal to 1, indicating that the actor is now a chick.
This way, the touch rule will not trigger again on subsequent touches as EggState is no longer 0.
Using attributes to indicate and switch the state of an actor is quite fundamental to game development. Experiment and learn to use it extensively.
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
Thanks Hopscoth,
That worked like charm. Sorry about two postings I was not sure which one was the right group. I will learn by hanging around.
You might be able to help me with another issue ( its my first time using Gamesalad and first game ) I want to have an image change every time the sore is in multiple of 25, say at 25 one actor shows up at 50 the same actor changes to another image and at 75 it changes again and so forth. I just haven't been able to get my head around it.
Thanks.
Regards,
Umesh
@lashukla, what do you have so far?
A game level Score attribute?
Then, in the actor which is supposed to change its image, add rules...
Rule if game.Score < 25
Change Image
Rule if game.Score >= 25 and game.Score < 50
Change Image
Rule if game.Score >= 50 and game.Score < 75
Change Image
etc.
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
Thanks that makes perfect sense. I bought a template to learn from and am adding my own additions to understand it better. The forums have been a great help as well as the YouTube videos.
Best,
Umesh
Checkout my GSLogic series it is a good learning series on how to build logic.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS