Alice Community  

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

Reply
 
Thread Tools Display Modes
I am having alot of trouble trying to make this work
Old
wolfgang
Guest
 
Status:
Posts: n/a
Default I am having alot of trouble trying to make this work - 10-08-2009, 01:51 PM

I am trying to make it so, when i shoot the zombie (with the fire.animation), the zombie turns invis, then goes back to the coffin, then becomes seen again, and finally starts moving towards me again. But I cant get it too work, here's my code in the attachment.
If anyone would look it over and help me, that would be great.

BTW, fireAnimation.kill is where i think is the problem, but i dont really know.
Attached Files
File Type: zip zombieTurret(2).zip (1.9 KB, 6 views)
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 10-08-2009, 02:17 PM

It would be helpful if you told me exactly what the problem you're encountering is, as there are a few things you could be talking about that I can see.

Also, how did you get your code into that webpage format? I thought the export as web page option didn't work.
   
Reply With Quote
Old
wolfgang
Guest
 
Status:
Posts: n/a
Default 10-08-2009, 04:25 PM

Quote:
Originally Posted by x2495iiii View Post
It would be helpful if you told me exactly what the problem you're encountering is, as there are a few things you could be talking about that I can see.

Also, how did you get your code into that webpage format? I thought the export as web page option didn't work.
well in fireAnimation.kill i have it as:
If fireanimation is within .01 meters of zombie
zombie is showing false
zombie move to coffin
zombie is showing true

Now my problem is that nothing is happening no matter how close the fire animation gets to the zombie

Also, im using this at my high school, so that might be the reason the export is working.
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 10-08-2009, 07:03 PM

Okay well, the reason it's not working is because the distance you set is MUCH too small. .01 meters means that the two center points of the objects, not their bounding boxes, have to be .01 meters apart to trigger the method. This would be like shooting the zombie in the eyeball every time - nearly impossible. Increase the "If fireanimation is within .01 meters of zombie" distance to .5 meters and see if that helps.
   
Reply With Quote
Old
wolfgang
Guest
 
Status:
Posts: n/a
Default 10-08-2009, 07:12 PM

Quote:
Originally Posted by x2495iiii View Post
Okay well, the reason it's not working is because the distance you set is MUCH too small. .01 meters means that the two center points of the objects, not their bounding boxes, have to be .01 meters apart to trigger the method. This would be like shooting the zombie in the eyeball every time - nearly impossible. Increase the "If fireanimation is within .01 meters of zombie" distance to .5 meters and see if that helps.
nope still not working, i changed it to .5 and it didnt work, so i changed it to 1 and it still didnt work.
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 10-08-2009, 09:49 PM

Makes no sense unless there's something else stopping the method from executing.

Hold on a sec, I'm going to try and re-create your world.

Alright, how far away from the camera are your zombies? One of the things I did without even thinking about it was put the zombie too far away, meaning that the fire never reaches the zombie before it comes back.

By the way, the distance I got for Alice to recognize that the fire had hit the zombie itself was about 1 meter, and for a dummy object at the zombie's center .4 meters. (The dummy object allows for fewer near-misses counted as hits)

Last edited by x2495iiii; 10-08-2009 at 10:26 PM.
   
Reply With Quote
Old
wolfgang
Guest
 
Status:
Posts: n/a
Default 10-09-2009, 05:56 AM

Quote:
Originally Posted by x2495iiii View Post
Makes no sense unless there's something else stopping the method from executing.

Hold on a sec, I'm going to try and re-create your world.

Alright, how far away from the camera are your zombies? One of the things I did without even thinking about it was put the zombie too far away, meaning that the fire never reaches the zombie before it comes back.

By the way, the distance I got for Alice to recognize that the fire had hit the zombie itself was about 1 meter, and for a dummy object at the zombie's center .4 meters. (The dummy object allows for fewer near-misses counted as hits)
im going to upload the actual world here so it will be easier:
Attached Files
File Type: zip zombieTurret(2).zip (2.22 MB, 4 views)
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 10-09-2009, 04:43 PM

Okay, two problems I noticed are the cause of it.

First, I was right, the fire has to move further away when it's shot, otherwise it doesn't reach the zombies

Second, your collision detection is inside your fire method instead of in an infinity loop. Because of this, the game will only check for collision once the fire has returned to the gun, meaning it will never register a collision.

Move the "If fireAnimation is within .1 meters of zombie3" statement to a method which starts when the world does and loops infinity times. That way, the world is constantly checking to see if the fire has hit its mark.
   
Reply With Quote
Old
wolfgang
Guest
 
Status:
Posts: n/a
Default 10-10-2009, 06:49 PM

Quote:
Originally Posted by x2495iiii View Post
Okay, two problems I noticed are the cause of it.

First, I was right, the fire has to move further away when it's shot, otherwise it doesn't reach the zombies

Second, your collision detection is inside your fire method instead of in an infinity loop. Because of this, the game will only check for collision once the fire has returned to the gun, meaning it will never register a collision.

Move the "If fireAnimation is within .1 meters of zombie3" statement to a method which starts when the world does and loops infinity times. That way, the world is constantly checking to see if the fire has hit its mark.
well i changed it as you directed, and its so close to working correctly. The zombies do disapear when hit by the fire.animation, however they wont go back to the casket, they just disapeer for a second and then reapear, and keep going to me.

the attachment is the new version
Attached Files
File Type: zip zombieTurret(2).zip (2.22 MB, 7 views)
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 10-11-2009, 09:49 PM

I actually know why that is without even looking.

When I first saw your world's code, I noticed that you have the zombies move to the camera in a duration of 25 seconds. This method CANNOT be interrupted, which is why the zombies are 'unstoppable.' Change this method to something like:

while zombie.isAlive
zombie move toward camera .005 meters in 0 seconds

This way, Alice is constantly checking to see if the zombie has been shot, and will stop moving it the instant it has (provided zombie.isAlive is set to false as soon as it's shot).
   
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 ©2023, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.