Alice Community  

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

Reply
 
Thread Tools Display Modes
OMG help me... how to keep track of things I shoot with a gun
Old
lmwozniak
Guest
 
Status:
Posts: n/a
Exclamation OMG help me... how to keep track of things I shoot with a gun - 05-04-2009, 06:15 AM

Ok, I know this was posted already (http://www.alice.org/community/showthread.php?t=2308) but the responses to the thread were really unclear to me. I am NOT GOOD at Alice, but my teammates in our game gave me the project of designing the counter.

The story is such: guy with gun is shooting zombies coming after him.

Very basic. I have tried working out the code using both a while statement and an if statement, and CLEARLY I am doing something wrong.

Does anyone have any code written for something similar that they wouldn't mind sharing with a lowly, desperate student?
   
Reply With Quote
Old
Scott300
Senior Member
 
Status: Offline
Posts: 80
Join Date: Feb 2009
Location: Ohio
Default 05-06-2009, 12:27 AM

It will all need to be done with variables
//declare your variable in world make it a number and set its default to the starting amount of ammo you want them to have

var bulletsleft = 5

/////////////////////////////
put this next code in the method called when you fire
/////////////////////////////
if bulletsleft <= 0
{
print "shit son your screwed your out of ammo!"
}
else
{
decrease bulletsleft by 1
}
////////////////////////////
so now every time you fire it will first check to see if 0 is greater than or = to your current ammo if you have more than 0 ammo left it will take 1 off your current ammo as you just fired the weapon!
  Send a message via AIM to Scott300 Send a message via MSN to Scott300  
Reply With Quote
Reply

Tags
bullet, counter

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