Alice Community  

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

Reply
 
Thread Tools Display Modes
Object Impact
Old
123alice
Guest
 
Status:
Posts: n/a
Default Object Impact - 09-21-2010, 06:11 PM

How would I make an object fall on its side when another object hits it? Like if I were making a shooting game and when I clicked an object the bullet would move toward it and when it touches it the other object falls over.
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 978
Join Date: Sep 2009
Location: United States
Default 09-21-2010, 06:29 PM

There are many examples of this in the forums, but the easiest way is to make an actual bullet, and and put in an event saying "While(bullet) is within 2 meters of (enemy)", "enemy turn backwards 0.25 revolutions". This however is not the most accurate way to do it because you might be able to aim next to the person and still have it count as a hit. For a beginner programmer though, I recommend using the code I just said.

If you feel you know a little more about Alice and you are able to understand more complex code, you can check out any of the gun games made here on the forums, I know that Debussybunny just made a new gun game with a good way of detecting bullets. Also, I am going to finish my Sniper example in a few days hopefully which should provide a fairly accurate bullet collision example.


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
Reply With Quote
Old
debussybunny563
Senior Member
 
debussybunny563's Avatar
 
Status: Offline
Posts: 852
Join Date: May 2010
Arrow 09-21-2010, 06:29 PM

See here: Bullet Collision

EDIT: A tip if you're going to use Dameria's first example: Don't make the bullet move too fast (i.e. 1000 meters in 0.1 seconds-never use zero for the duration, it will probably never register a hit) , or it will be less likely to detect. Experiment around to see what works best-if you want a rapid fire rate, balance it with a slow enough bullet speed.
One workaround is to make several bullets, each bullet itself moving at a slow speed, but when you put one after another in rapid succession, it seems quick.


Last edited by debussybunny563; 12-21-2012 at 12:00 AM.

|--------------------------------------------------------------------------------------------------|
|Link to weapons collection: http://www.alice.org/community/showthread.php?t=7368 |
|--------------------------------------------------------------------------------------------------|

I have been dead for quite some time now; not much hope for resurrection.

Last edited by debussybunny563; 09-21-2010 at 06:47 PM.
   
Reply With Quote
Old
123alice
Guest
 
Status:
Posts: n/a
Default 09-21-2010, 06:32 PM

Ok cool,thanks to both of you.
   
Reply With Quote
Reply

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