I need help with my trade system

Game Editor comments and discussion.

I need help with my trade system

Postby Pengaboy » Tue Feb 11, 2014 10:06 pm

Hello, i started to create a game.
However i ran into the problems while wanted to add trade system.

How i can add system that indicates following:
when i press update button then it removes 2500 from cash (how to limitate that if my cash is less than 2500 then it just does nothing?)
when i press update button then it raises update price twice (how to indicate how many updates i have done?)
when i press update button then it changes the base image (if i have enough cash for that)?
how to set per update diffirent images while using single update button?

Thanks for help :)
If everything is possible, then its possible that something is impossible!
LoL!

Creating Games Is Art R E S P E C T I T !!!
http://i43.servimg.com/u/f43/13/13/31/96/displa10.gif
User avatar
Pengaboy
 
Posts: 34
Joined: Wed Jun 06, 2012 11:24 am
Location: somewhere in my dreams
Score: 1 Give a positive score

Re: I need help with my trade system

Postby skydereign » Tue Feb 11, 2014 11:31 pm

Pengaboy wrote:Hello, i started to create a game.
However i ran into the problems while wanted to add trade system.

How i can add system that indicates following:
when i press update button then it removes 2500 from cash (how to limitate that if my cash is less than 2500 then it just does nothing?)
when i press update button then it raises update price twice (how to indicate how many updates i have done?)
when i press update button then it changes the base image (if i have enough cash for that)?
how to set per update diffirent images while using single update button?

Thanks for help :)

Do you know about if statements and variables? You can use an if statement and a few variables to do all of that. Here's a small example of an if statement.
Code: Select all
if(cash>=2500)
{
    // this code only runs when you have at least 2500
    // buy whatever item
    cash -= 2500; // removes extra cash
}
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: I need help with my trade system

Postby Pengaboy » Wed Feb 12, 2014 2:54 am

skydereign wrote:
Pengaboy wrote:Hello, i started to create a game.
However i ran into the problems while wanted to add trade system.

How i can add system that indicates following:
when i press update button then it removes 2500 from cash (how to limitate that if my cash is less than 2500 then it just does nothing?)
when i press update button then it raises update price twice (how to indicate how many updates i have done?)
when i press update button then it changes the base image (if i have enough cash for that)?
how to set per update diffirent images while using single update button?

Thanks for help :)

Do you know about if statements and variables? You can use an if statement and a few variables to do all of that. Here's a small example of an if statement.
Code: Select all
if(cash>=2500)
{
    // this code only runs when you have at least 2500
    // buy whatever item
    cash -= 2500; // removes extra cash
}


cash is variable or actor?
If everything is possible, then its possible that something is impossible!
LoL!

Creating Games Is Art R E S P E C T I T !!!
http://i43.servimg.com/u/f43/13/13/31/96/displa10.gif
User avatar
Pengaboy
 
Posts: 34
Joined: Wed Jun 06, 2012 11:24 am
Location: somewhere in my dreams
Score: 1 Give a positive score

Re: I need help with my trade system

Postby skydereign » Wed Feb 12, 2014 3:15 am

Pengaboy wrote:cash is variable or actor?

It is an integer variable. Though you'll need to create it to actually use it.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: I need help with my trade system

Postby Pengaboy » Wed Feb 12, 2014 3:25 am

skydereign wrote:
Pengaboy wrote:cash is variable or actor?

It is an integer variable. Though you'll need to create it to actually use it.


yeah. its working but i need that it print the value of cash on text actor.
here is the code i use at the moment, i think something wrong with that...
Code: Select all
if(cash >= 2500)
{
    statnumber_cash.textNumber = statnumber_cash.textNumber - 2500;
    cash -= 2500;
}
If everything is possible, then its possible that something is impossible!
LoL!

Creating Games Is Art R E S P E C T I T !!!
http://i43.servimg.com/u/f43/13/13/31/96/displa10.gif
User avatar
Pengaboy
 
Posts: 34
Joined: Wed Jun 06, 2012 11:24 am
Location: somewhere in my dreams
Score: 1 Give a positive score

Re: I need help with my trade system

Postby skydereign » Wed Feb 12, 2014 4:26 am

Pengaboy wrote:here is the code i use at the moment, i think something wrong with that...

What is wrong exactly? What should it be doing instead of what it is doing now? That code should only let you decrease cash when it is greater than or equal to 2500, and when you press it it will update the textNumber's value and reduce cash. However if that is what you want it to do, I'd recommend setting it like follows (this way is slightly cleaner).
Code: Select all
if(cash >= 2500)
{
    cash -= 2500;
    statenumber_cash.textNumber = cash;
}
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: I need help with my trade system

Postby Pengaboy » Wed Feb 12, 2014 5:03 am

tried that but i didnt work in some odd reason lol, but is there some way to print the value of cash variable instead of single updates so it updates itself automatically.
because that way i keep the code more clear :)

btw i shall explain about system a bit more though :D
Actors and Variable im using:
cash(variable/integer/global/array:no/save group:stats
statnumber_cash(text actor for numbers to show cash)
upgrade_button(button for sending commands to actors)

i mean when i click upgrade button then it works like upgrade_button -> cash -> statnumber_cash
and so on :D
If everything is possible, then its possible that something is impossible!
LoL!

Creating Games Is Art R E S P E C T I T !!!
http://i43.servimg.com/u/f43/13/13/31/96/displa10.gif
User avatar
Pengaboy
 
Posts: 34
Joined: Wed Jun 06, 2012 11:24 am
Location: somewhere in my dreams
Score: 1 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest