View Full Version : Flash 5 RPG help
JcDenton93
10-24-2004, 05:54 PM
Hello, I remember that I posted about this over the summer, but, when u use the"money doesen't go under 0" code, how do you stop it from buying the thing also?
illrainman
10-25-2004, 03:54 PM
On the button or code that tests to see if the button is pressed or whatever, put this:
if (money>0) {
buyItem();
} else {
dontbuyItem();
}
arkhan
10-26-2004, 06:23 PM
but with that u get..
if the guy have 30 and wants to buy somenthing of 200..he will buy it and have -170..and only TEHN he wont be able to buy anything..
so u gotta add just somenthing
if ((money-price)>0) {
buyItem();
} else {
dontbuyItem();
}
this way you check if he will be under 0 after buying, before he actually buys it..so u cant o to negative(hoping to be understood..im very confusing at explanations..)
MatchbookRomance
11-01-2004, 04:30 PM
usually when i have people buy items its like this:
on (release) {
if (money >= price) {
buyitem();
money -= price;
} else {
dontbuyitem();
}
}
theneedforsex
12-08-2004, 06:08 AM
Wouldnt it just be easier:
if (money>=200) {
buyAmmo();
}
else {
trace ("Not enough money!");
}
doesnt trace only show within flash so that would do anything unless you linked it to a dynamic text box, mayswell just leave it as
usually when i have people buy items its like this:
on (release) {
if (money >= price) {
buyitem();
money -= price;
} else {
dontbuyitem();
}
}
[/quote]
theneedforsex
12-08-2004, 08:27 AM
doesnt trace only show within flash so that would do anything unless you linked it to a dynamic text box, mayswell just leave it as
usually when i have people buy items its like this:
on (release) {
if (money >= price) {
buyitem();
money -= price;
} else {
dontbuyitem();
}
}
[/QUOTE]Yeah, i know it does... but it was only an example! The code can be adjusted... So that it fits to the users needs!...
yes but the way you did it wouldnt have worked at least i dont think it would have for others seeing it on the web .. which is why i said it not to prove you wrong but for the guy who started the topic so he doesnt get confused
vBulletin® v3.7.3, Copyright ©2000-2009, Jelsoft Enterprises Ltd.