Axl Trauts
Member
Hi guys,
I am making a weapon system and a shop which I'd like to make better, I hope you can help.
Well, I am making an action game where the player gets upgrades on the level and changes its main gun, only there are 3 types, only one type at a time can be carried, and each one can be upgraded with consecutive powerup grabs/collisions with the powerup object (ie. first you shoot one missile, then two; and so for each type).
Then I wanted to start implementing a shop, where the player can buy the powerup upgrade and/or buy extra weapons which can be carried along with the main gun.
So, I have three questions:
1.: I have created a global variable called global.var_powerup that ranges from 1-3 for one type (regular shot) and its upgrades, 11-13 for the second (missiles), etc. They are easily handled because one is selected at a time.
Now that I think of it, if you have the powerup at 3 (shot level 3) and you change for missiles you start at 11 (missile level 1), and if you change back to regular shot, you go back to shot level 2. Maybe that is not fair.
2.: For extras, on the other hand, the player can carry more than one. I can create a different global variable for each extra, but maybe there is a better idea?
3.: Anyways, for the shop thing, I am having trouble with texts.
I created an item object, the missile, that in its Draw event when you hover over the object a Text is drawn elsewere stating the price, as long as the mouse is over the object. When you purchase, the price is substracted from the "purse" and a text saying "Gracias" (Thanks) is shown below the price, but I´d like it to be more persistent, as it last only a bit. The "Thanks" message will be erased after a while or when you hover over another item object. I am not sure how.
I am making a weapon system and a shop which I'd like to make better, I hope you can help.
Well, I am making an action game where the player gets upgrades on the level and changes its main gun, only there are 3 types, only one type at a time can be carried, and each one can be upgraded with consecutive powerup grabs/collisions with the powerup object (ie. first you shoot one missile, then two; and so for each type).
Then I wanted to start implementing a shop, where the player can buy the powerup upgrade and/or buy extra weapons which can be carried along with the main gun.
So, I have three questions:
1.: I have created a global variable called global.var_powerup that ranges from 1-3 for one type (regular shot) and its upgrades, 11-13 for the second (missiles), etc. They are easily handled because one is selected at a time.
Now that I think of it, if you have the powerup at 3 (shot level 3) and you change for missiles you start at 11 (missile level 1), and if you change back to regular shot, you go back to shot level 2. Maybe that is not fair.
Code:
//Object powerup 1, collision with object player
//Same goes with powerup 2 and 3
if global.var_powerup=0 or global.var_powerup>10
{ global.var_powerup=1; exit;}
if global.var_powerup=1
{ global.var_powerup=2; exit;}
if global.var_powerup=1
{ global.var_powerup=2; exit;}
3.: Anyways, for the shop thing, I am having trouble with texts.
I created an item object, the missile, that in its Draw event when you hover over the object a Text is drawn elsewere stating the price, as long as the mouse is over the object. When you purchase, the price is substracted from the "purse" and a text saying "Gracias" (Thanks) is shown below the price, but I´d like it to be more persistent, as it last only a bit. The "Thanks" message will be erased after a while or when you hover over another item object. I am not sure how.
Code:
//object obj_item_misil, Draw event
if distance_to_point(mouse_x,mouse_y)<=0 and var_comprado=1
{ draw_sprite(spr_item_misil_on,image_index,x,y)
draw_text(448,224,"VALOR (Value) $20")
if mouse_check_button_released(mb_left) and global.var_player_purse>=item_cost
{ global.var_player_purse=global.var_player_purse - item_cost
draw_text(448,244,"Gracias (Thanks)")
}
else if mouse_check_button_pressed(mb_left) and global.var_player_purse<item_cost
{ draw_text(448,264,"NO HAY SUFICIENTE DINERO (Not enough money)");
}
}
else draw_self();