how to change movement speed when click on actor
ronre
Member Posts: 38
hello,
i have one button "speed" and one "car".
i have spawner that spawn car and i want the car movement speed to increase +50 every click on the "speed" actor.
what i did:
i added attribute "increase" (integer)
speed buttom:
when actor recives event touch inside
change attribute game.increase To: 1
the car:
move behavior with 100 in the speed.
rule: when attribute game.increase=1
move behavior and in the speed i put self.time +50
its working but how can i make it to increase the speed again and again?
foe now its working only one time.
Comments
Instead of 100, put 100 + game.increase in the speed field.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
thank you but its not working..
its still increase the speed only one time.
what should i do?
Sorry, I just re-read your initial post. I thought game.increase was the amount you wanted to increase the speed but I see you're using it like a boolean instead. I see that you're trying to use self.Time to increase the speed over time. I actually thought that might work but it appears that the Move behavior is using the first value of self.Time and not updating.
Try this demo.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
hey,
can you make a demo that show the increase by cliking on "speed bottom?"
i want it the increase to be by clicking on other actor.
so, i have one "increase rule" integer for the "speed buttom".
and one "newspeed" integer for the move's behavior field.
in the speedbuttom i have:
when actor recives event touch inside
change attribute game.increase To: 1
in the Car actor, inside the "move" behavior im putting self.newspeed +50
and then i have a rule:
when attribute: game.speed buttom =1
then, change attribute: newspeed To: newspeed +10
its not working, may you create a demo that increase the speed by clivking on other actor? thank you!
You need to use a game attribute (not an actor "self" attribute) for the speed. That way both actors can access that attribute.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Here's a modified demo.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
great, One last thing..
i have spawner that spawne the cars and i want the speed of the next car to be the same of the previous actor. for example, if car one start at 20 and increase to 300, the next spawned car will start in 300 and again and again.
I really appreciate the help
Will you then be able to click the speed button to increase the speed of just the original actor, just the newly spawned actor, or both?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
both.. it needs to looks like the spawner increase the speed of the cars that he spawned.
if i klick on the speed buttom he needs to change the speed of all actors that will be spawne.
thank you.
The modified demo I posted should work that way already. If you increase the speed and it's a single game attribute for all cars, they will spawn at that speed and continue to increase afterwards.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
working perfect. thank you!