The Enchanted Cave 2
Delve into a strange cave with a seemingly endless supply of treasure, strategically choos
4.34 / 5.00 31,296 ViewsGhostbusters B.I.P.
COMPLETE edition of the interactive "choose next panel" comic
4.07 / 5.00 10,082 Viewson (release) {
if(_root.gun==0 && money>=500 && tired<=50){
robvar=Math.ceil(Math.random()*6) ;
if (robvar==1){
_root.money +=random(5000)
if(_root.gun==0 && money>=500 && tired<=50){
robvar=Math.ceil(Math.random()*6) ;
if (robvar==1){
_root.money +=random(5000)
tired +=50
gotoAndStop (2);
}
if (robvar==2){
_root.money -=500
_root.day += 15
tired +=50
gotoAndStop(3);
}
if (robvar==3){
_root.money -=500
_root.day += 15
tired +=50
gotoAndStop(4);
}
if (robvar==4){
gotoAndStop(5);
}
if (robvar==5){
_root.money -=500
_root.day += 15
tired +=50
gotoAndStop(6);
}
if (robvar==6){
_root.money -=500
_root.day += 15
tired +=50
gotoAndStop(7);
}
}
}
}
else if (_root.gun==1 && money>=500 && tired<=50) {
robvar=Math.ceil(Math.random()*3) ;
if (robvar==1){
_root.money +=random(5000)
tired +=50
gotoAndStop (8);
}
if (robvar==2){
_root.money -=500
_root.day += 15
tired +=50
gotoAndStop(9);
}
if (robvar==3){
_root.money -=500
_root.day += 15
tired +=50
gotoAndStop(10);
}
}
else if (_root.money<=500) {
gotoAndStop(11);
}
else if (_root.tired>50) {
gotoAndStop(12);
}
}
That's supposed to make it so that you have to have under 50 "tired" and over 500 "money." If you have 1 gun, it's supposed to give you better odds.
What it does is pretty much just go off on its own thing. Any suggestions?
"Whoever said 'winners never quit' obviously never considered addicts." - Hoeloe
"Whoever said 'winners never quit' obviously never considered addicts." - Hoeloe
wow, your code is so messy. Why don't you use switch...case statements.
Tell us more specifically what you want to accomplish and then we'll (or at leats I'll ) help.
Okay, in the game, I want the player to have the option to rob a bank. When you try it without 1 of the "gun" variable, I want 6 random numbers to be generated, all going to a different scene inside the movieclip and taking away/adding to variables. To do this, I want the player to need at least 500 "money" and energy to be less than or equal to 50. I want four of these five tries to take away 500 from the "money" variable and add 15 to the "day" variable. I want one of them to just add 50 to the "tired" variable, and one to add a random number between 1 and 5,000 to the "money" variable.
If you try to rob it with 1 of the "gun" variable, I want the player to have one possibility to get the random number between 1 and 5,000 to "money" and two chances to take away 500 from the "money" variable and add 15 to the "day."
Help?
"Whoever said 'winners never quit' obviously never considered addicts." - Hoeloe
At 2/1/07 08:41 PM, uyersuyer wrote: code
Er... I'm confuzzled. That is confusing code. I agree with deltatsunami and just use switch case statements. ie:
if (active == true) {
switch (option) {
case 1 :
_root.movement(moveX, moveY, this);
break;
Actually, I took that from the AS War code. :D
Research switch case stuff.
postcount +=1;
Newgrounds Photoshop Headquarters || Don't use MS Paint! Use Aviary!
SING US A SING YOU'RE THE PIANO MAN
I don't understand the switch case thing and I can't find any tutorials. Anybody wanna try to explain?
"Whoever said 'winners never quit' obviously never considered addicts." - Hoeloe
There aren't many tutorials because it's well explained in the language reference. Hit f1 some?
on (release) {
if (_root.gun==0 && money>=500 && tired<=50){
robvar=Math.ceil(Math.random()*6) ;
if (robvar==1){
_root.money +=random(5000)
tired +=50
gotoAndStop (2);
}
if (robvar==2){
_root.money -=500
_root.day += 15
tired +=50
gotoAndStop(3);
}
if (robvar==3){
_root.money -=500
_root.day += 15
tired +=50
gotoAndStop(4);
}
if (robvar==4){
gotoAndStop(5);
}
if (robvar==5){
_root.money -=500
_root.day += 15
tired +=50
gotoAndStop(6);
}
if (robvar==6){
_root.money -=500
_root.day += 15
tired +=50
gotoAndStop(7);
}
}
else if (_root.gun==1 && money>=500 && tired<=50) {
robvar=Math.ceil(Math.random()*3) ;
if (robvar==1){
_root.money +=random(5000)
tired +=50
gotoAndStop (8);
}
}
if (robvar==2){
_root.money -=500
_root.day += 15
tired +=50
gotoAndStop(9);
}
if (robvar==3){
_root.money -=500
_root.day += 15
tired +=50
gotoAndStop(10);
}
else if (_root.money<=500) {
gotoAndStop(11);
day -= 30;
}
else if (_root.tired>50) {
gotoAndStop(12);
day -= 30;
}
}
I didn't really completely understand switch case so I tried just reworking my original AS and now it works BETTER but not perfect. Any tips?
"Whoever said 'winners never quit' obviously never considered addicts." - Hoeloe
"Whoever said 'winners never quit' obviously never considered addicts." - Hoeloe