text codes

Game Editor comments and discussion.

text codes

Postby jagheera nex » Wed Sep 19, 2007 2:38 am

ok im making a shop in my game and i have it so when you move your curser on the item the shop info actor says how much the item is, and i also got it so when you click on item it goes i your iventory, and where it subtracts that amount, but if you don't have enuph money it still goes in your inventory and the your money amount goes negative, the thing i need to know is how to make it so it doesn't go negative and the shop info actor says somthing like,"you don't have enuph money!"
User avatar
jagheera nex
 
Posts: 46
Joined: Sat Jul 28, 2007 4:13 pm
Location: dik
Score: 1 Give a positive score

Re: text codes

Postby d-soldier » Wed Sep 19, 2007 2:50 am

you need to setup some "if" statements, such as:
on the "buy" event (keydown/mouse button down/etc.)

if (money >= 250)
{
insert your item stuff and money subtraction stuff here;
}
else if (money <= 250)
{
insert your "you don't have enough money for that!" stuff here;
}
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Re: text codes

Postby Fuzzy » Thu Sep 20, 2007 12:52 am

d, that little snippet of code would display both messages if you had exactly 250 money.
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Re: text codes

Postby jagheera nex » Thu Sep 20, 2007 1:35 am

but the thing is idk how to make the "you don' have enuf money" actor :cry:
User avatar
jagheera nex
 
Posts: 46
Joined: Sat Jul 28, 2007 4:13 pm
Location: dik
Score: 1 Give a positive score

Re: text codes

Postby jagheera nex » Thu Sep 20, 2007 2:48 am

and fuzzy what wuld you put?
User avatar
jagheera nex
 
Posts: 46
Joined: Sat Jul 28, 2007 4:13 pm
Location: dik
Score: 1 Give a positive score

Re: text codes

Postby d-soldier » Thu Sep 20, 2007 5:58 pm

Whoops, good catch Fuzzy...

on the "buy" event (keydown/mouse button down/etc.)

if (money >= 250)
{
insert your item stuff and money subtraction stuff here;
}
else if (money <= 249)
{
insert your "you don't have enough money for that!" stuff here;
}
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron