Pushing a button to make an actor move - Question
RastaRise
Member Posts: 52
i have four arrow left, right, up, and down. How do i make the buttons move the actor? Ex. when left arrow is touched the actor moves left.
Any help would be greatly appreciated!
Jon
Any help would be greatly appreciated!
Jon
Comments
Go through some of the tutorials.
The concept is a pain to get but it is really central to GS.
Its basically how actors speak to each other through a middleman
Button changes attribute > actor reads change in attribute.
There are plenty of tutorials on how to do it. THere is a jumping demo on my wall too that has it.
Cheers, Weswog
Make 4 integer attributes: left, right, up, down
Make the following rule in your left arrow:
When touch is pressed, change attribute (left) to 1
Otherwise, change attribute (left) to 0
Now go into the actor that you want to move and give it the following rule:
When attribute (left) is 1:
Move actor (direction left)
Otherwise
Change attribute (left) to 0
Do this for the other 3 arrows with the attributes right, up, and down and give the moving actor 3 new rules with the movements going right, up, and down
Hope this helped