Alice Community collision detection in myFirstMethod

 collision detection in myFirstMethod
 coynerm Junior Member   Status: Offline Posts: 5 Join Date: Sep 2013 collision detection in myFirstMethod - 12-16-2015, 12:47 PM version Alice3: I had to put a while loop in myFirstMethod() in order for the collision detection functions to detect/work. makes sense now that i think about it...keeps looping/scanning for collision events...right? New problem: counter variable keeps incrementing b/c each collision is counted multiple times b/c its in a while loop. fixed this by moving object away so it doesnt multiple detect collision. is there a way to delete or remove an object from a running program upon collision? ie pirate ship collides w/ iceberg so iceberg is deleted/removed. thx for any feedback. Mike
 MrMoke Senior Member     Status: Offline Posts: 500 Join Date: Sep 2007 Location: Austin, Texas 12-16-2015, 01:50 PM Sink it below the surface. You can't collide with it if it's out of reach. Last edited by MrMoke; 12-17-2015 at 10:52 AM.
 RavenOfCode Senior Member     Status: Offline Posts: 408 Join Date: Oct 2013 Location: Northern Virginia 12-17-2015, 05:21 AM There is no Destroy method, but you can use the SetActive method to turn it off. It will not collide then. Stuff + Other Stuff + Different Other Stuff = Things :) My best Alice game: Clash of the Cubes (an arena fighting game): http://www.alice.org/community/showthread.php?t=10738&highlight=game
 Events
chickentree
Super Moderator

Status: Offline
Posts: 212
Join Date: Dec 2012
Location: Frosno, Ca
Events - 12-17-2015, 03:03 PM

Quote:
 Originally Posted by coynerm version Alice3: I had to put a while loop in myFirstMethod() in order for the collision detection functions to detect/work. makes sense now that i think about it...keeps looping/scanning for collision events...right? New problem: counter variable keeps incrementing b/c each collision is counted multiple times b/c its in a while loop. fixed this by moving object away so it doesnt multiple detect collision. is there a way to delete or remove an object from a running program upon collision? ie pirate ship collides w/ iceberg so iceberg is deleted/removed. thx for any feedback. Mike
A better approach might be to use an event rather than an infinite while loop.

Mark

Mark Henwood
mhenwood@ieee.org

 Thread Tools Display Modes Linear Mode

 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 Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements     Community News and Announcements Alice 3     How Do I?     Works In Progress     Share Your World     Share Custom Classes     Bugs and Trouble Shooting     Suggestion Box Alice 2     How do I...?     Works-In-Progress     Share Worlds     Share Objects     Bugs and Troubleshooting     Suggestion Box Educators     Teaching with Alice     Teaching Using Alice 3     Teaching Using Alice 2     CS Principles and Alice     AP CSA and Intro to Java and Alice     Workshops General Discussion     Questions and Comments     The Lounge