Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
How do i do this
Old
rohan123444
Guest
 
Status:
Posts: n/a
Unhappy How do i do this - 11-25-2009, 05:02 PM

Well i have a question about this program. I have this program where a car moves when the world starts. What i want to do is if the mouse is clicked on the car while the method is running, I don't want anything to happen, but if the mouse is clicked on the car when the method isn't running then i want the move method to repeat. I know it has something to do with a variable but i cant seem to get it to work. If you could please fix my program and repost it and walk me through what you did that would be greatly appreciated.

If you cant open it, then this is what is in the program. I have a world method called my first method and i have a world boolean variable called ifMethodIsRunning in the world's properties and i have the default to true.

This is how my first method looks

Do together
Loop infinity times
print world.If.Car.Is.Moving
Do in order
car move forward five meters

Now i dont know where to put the variable in my method and what to put in the world event. If you could please explain this i would be very happy.

Right now i have as the world event when the world starts do my first method.

I NEED HELP PLEASE
Attached Files
File Type: a2w practice.a2w (189.2 KB, 4 views)
   
Reply With Quote
Old
dubastot
Senior Member
 
dubastot's Avatar
 
Status: Offline
Posts: 661
Join Date: Apr 2009
Location: Two Steps From Hell
Default 11-25-2009, 05:46 PM

All you do is make a boolean variable and make it set to true while your car moving method is running. Have an if/ else statement saying if boolean variable=true do nothing and in the else box add another if statement saying if boolean variable=false car start moving. It should look something like this:

if
boolean variable=true
[I]do nothing/I]

else
if boolean variable=false
Do together
Loop infinity times
print world.If.Car.Is.Moving
Do in order
car move forward five meters
   
Reply With Quote
It doesn't work
Old
rohan123444
Guest
 
Status:
Posts: n/a
Smile It doesn't work - 11-25-2009, 08:03 PM

It doesnt seem to work. Could you try opening up my program up above or just creating your own program and posting it here so i could see that would realllly help!!!
   
Reply With Quote
Reply

Tags
how to, variables


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.