Alice Community  

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

Reply
 
Thread Tools Display Modes
Is there a way to use a list in a certain way in an if/else statement (see post)
Old
Nrocks4evah
Guest
 
Status:
Posts: n/a
Unhappy Is there a way to use a list in a certain way in an if/else statement (see post) - 12-14-2010, 10:24 PM

Ok i am trying to build a flight simulator but i am stuck. Is there a way to use an object list for a if statement


*- the list of object the plane can collide with



Boolean Function world.collision

parameter collisionObject

If plane within .1 of collisionObject
Return True
Else
Return False








Method

world.collide


Parameters - collisionObject


If collisionObject == world.CollisionObjects*
BlowUp
Else
do nothing



the problem is when ever i drag the list in, it asks for the first, last, a random, or ith number.
How do i get them all??
   
Reply With Quote
Old
haven812
Guest
 
Status:
Posts: n/a
Lightbulb 12-15-2010, 03:39 PM

In Alice, there are two commands that deal directly with lists: For All In Order, and For All Together. These are located at the bottom of the method editor. Drag "For All Together" into the method editor, and then select the world.CollisionObjects list. Now the if/else statement should be placed inside the For All Together. The if/else statement should now be changed to look like the following
pictureMethod.jpg
I also put the entire thing in a loop, because you probably want it to test all the time.

I hope this helped!
   
Reply With Quote
Reply

Tags
stuck if/else alice plane

Thread Tools
Display Modes

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 ©2023, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.