P
PixelProgrammer
Guest
So basically, I have a game where you buy upgrades with money. Pretty simple but since it's on android to "confirm" your purchase I used virtual keys. So the problem all the upgrades are bought at once if you have enough money. So an example code is:
if (upgrade == 1) {
if (keyboard_check_pressed(ord("p"))) {
if (cash >= 10000) {
upgrade = 2;
cash -= 10000;
}
}
}
if (upgrade == 2) {
if (keyboard_check_pressed(ord("p"))) {
if (cash >= 25000) {
upgrade = 3;
cash -= 25000;
}
}
}
if (upgrade == 3) {
if (keyboard_check_pressed(ord("p"))) {
if (cash >= 100000) {
upgrade = 4;
cash -= 100000;
}
}
}
Now instead of having to click the buy button each time (which is a virtual key), if you click it once and have enough money all upgrades will be bought instantly. The keyboard_check_pressed acts like keyboard_check.
I'm very sorry if this is really confusing, I'm doing my best to explain the issue, and if you need the game maker project file just ask.
Thanks for any help
if (upgrade == 1) {
if (keyboard_check_pressed(ord("p"))) {
if (cash >= 10000) {
upgrade = 2;
cash -= 10000;
}
}
}
if (upgrade == 2) {
if (keyboard_check_pressed(ord("p"))) {
if (cash >= 25000) {
upgrade = 3;
cash -= 25000;
}
}
}
if (upgrade == 3) {
if (keyboard_check_pressed(ord("p"))) {
if (cash >= 100000) {
upgrade = 4;
cash -= 100000;
}
}
}
Now instead of having to click the buy button each time (which is a virtual key), if you click it once and have enough money all upgrades will be bought instantly. The keyboard_check_pressed acts like keyboard_check.
I'm very sorry if this is really confusing, I'm doing my best to explain the issue, and if you need the game maker project file just ask.
Thanks for any help