Activate and Deactivate
Ok to try and sum it up. I have 7 platforms that the user can touch to make the player move to the touched platform. I have the code for the player to move to the selected platform and back to the starting point after a certain amount of time.
Here is a rough setup of the scene. (I like to try and code before I worry about graphics lol)
Now like I stated above what should happen is the player will touch a platform and the player moves there for lets say 3 secs, then moves back to the center. This part works for all the platforms. The problem that I am trying to avoid is letting the user touch more than one platform once one has been selected. So if I select red, I shouldn't be able to select anything else until the player is back in the middle.
I have tried this code:
Im sure everyone knows what I coded (or at least tried to), but I will explain it. I have a boolean game lvl att for each platform to know if it has been touched. I also have a boolean g.l.a to tell when the player's x and y are back in the original spot.
What ends up happening when I preview the game is that the player moves to the selected platform and back. BUT if another platform is selected before it returns or even after it returns. It moves to that platform and then back to the first one selected. As if it is remembering its path. How can I make it wait until the player is back in the middle and not do that remembering thing? I hope I am clear about this because im confusing myself. LOL
Comments
Reset the P7Touched to false after the player collides with the platform.
If my answer doesn't suffice, or if someone isn't able to answer it before I get home, I'll try to upload a template on here.
Alright let me try that. Thanks @RabidParrot
@RabidParrot Unfortunately it didn't work. I will keep working on it also to see if I can find out why.
Since you main player needs to be at a certain coordinate in order to move, just make a quick rule that when x is= 384 y=512 change game.startingposition to true. So you would add that when game.startingposition is true and touch is pressed conditions to your colored squares. You need to make sure and use touch is pressed instead of released since touch is released will remain active after release.
Edit:
384 and 512 can be changed to whatever he coordinate you want the starting position to be. And in the change game.startingposition to true rule make sure to have game.startingposition to false in the otherwise section.
I haven't really tested this but it should work, if you are still having trouble later ill make a quick demo.
Fortuna Infortuna Forti Una
Here you go @GamingtilDawn
@Lovejoy That is actually how I have it setup, but it just does that remembering thing. Thanks for the reply though
@RabidParrot Wow! Thank you, I never even thought to use a table for this. I really need to look over the benefits of tables again.