Alice Community  

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

Reply
 
Thread Tools Display Modes
collision detection in myFirstMethod
Old
coynerm
Junior Member
 
Status: Offline
Posts: 5
Join Date: Sep 2013
Default collision detection in myFirstMethod - 12-16-2015, 11:47 AM

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
   
Reply With Quote
Old
MrMoke
Senior Member
 
MrMoke's Avatar
 
Status: Offline
Posts: 501
Join Date: Sep 2007
Location: Austin, Texas
Default 12-16-2015, 12: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 09:52 AM.
   
Reply With Quote
Old
RavenOfCode
Senior Member
 
RavenOfCode's Avatar
 
Status: Offline
Posts: 409
Join Date: Oct 2013
Location: Northern Virginia
Default 12-17-2015, 04: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
   
Reply With Quote
Events
Old
chickentree
Super Moderator
 
Status: Offline
Posts: 250
Join Date: Dec 2012
Location: Frosno, Ca
Default Events - 12-17-2015, 02:03 PM

Quote:
Originally Posted by coynerm View Post
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
   
Reply With Quote
Reply


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.