Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   Object is within Threshold of Object (http://www.alice.org/community/showthread.php?t=3010)

Kosire 09-03-2009 07:52 PM

Object is within Threshold of Object
 
[B]I'm attempting to make a simple game with Alice 2.0. The game is the player controlling a tank's turret [/B]
[I](Left arrow key rotated it left, right arrow key rotates it right. at this point I dont suggest uing up and down)[/I][B]to shoot at
targets out in front of the tank.[/B]

[b]Right now when the tennis ball that is shot out reaches the target i placed, nothing happens. I used "If/Then"
with the "Object is within Threshold of Object" function and the If method is not performed when the tennis
ball enters the threshold specified.[/b]
[IMG]http://i174.photobucket.com/albums/w91/BlizzardTorrent/IfElse.jpg[/IMG]

[b]So now here it is.
[u]How do I...
Make this method so that when the moving tennis ball enters defined threshold of "target". The action
specified in "If" is performed?[/b][/u]

Kosire 09-04-2009 10:19 PM

Gah. I just can't figure out what's wrong with this. Does it not recognize it as threshold when arrow keys are controlling the objects movement either?

dubastot 09-10-2009 01:48 AM

THis is a little latte to answer, but the problem with your code is you need an infinte loop. You can look at the bottom of the alice window and right beside the if/else statement, you will see the loop option. Just drag it to the command board AND SELECT INFINITE LOOPS. Sorry for the caps. It should look something like this.

[I]Loop[/I] infinite times
[I]if/else [/I]
tennis ball is within 2 metres of random guy2
random guy2 roll left .2 revolutions duration=2 seconds


All times are GMT -5. The time now is 02:37 PM.

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