Alice Community  

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

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

Ok, I know this was posted already ( 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
Senior Member
Status: Offline
Posts: 80
Join Date: Feb 2009
Location: Ohio
Default 05-05-2009, 11:27 PM

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!"
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

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