Flash Games
 FAQ   Search   Memberlist   Usergroups   Register  Profile   Log in to check your private messages   Log in 


Need some help with shop



 

Post new topic   Reply to topic  
   DEVPPL Forum Index -> Flash Forum
View previous topic :: View next topic  
Author Message
xDabombx



Joined: 02 Jan 2008
Posts: 20

PostPosted: Wed Jan 23, 2008 2:10 am    Post subject: Need some help with shop Reply with quote

ok i have the basic idea for how to code a shop. for instince in my game i make it so when you kill someone you get +5 points(money) and i have a shop that if something costs $10 it would subtract 5 points, but i need help on making it so that you cant buy something you have enough money for, so it dosnt go into the negatives. any help at all would be greatly apreciated
Back to top
View user's profile Send private message
tkgd2007
50+ Club


Joined: 15 Nov 2007
Posts: 95

PostPosted: Sun Feb 10, 2008 12:37 pm    Post subject: Re: Need some help with shop Reply with quote

moneyvar is the amount of money you have in your wallet and amount is the amount of money the object you are trying to purchase.
The following code checks to make sure that you won't go into negative money by purchasing something.
Code:

if (moneyvar - amount >= 0){
    //do something
}


You could also add an error message saying you don't have enough money
Code:
else{
//error message or sound or whatever
}
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    DEVPPL Forum Index -> Flash Forum All times are GMT + 1 Hour
Page 1 of 1

 
 
Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums.
Click here to Register

If you are a current member here on DEVPPL, please login below:

User: Pass:
Log me on automatically each visit:

 


Powered by phpBB © 2001, 2005 phpBB Group - Modified by DEVPPL

Flash Games - Sitemap