Thanks! That works brilliantly, except for one thing.
I want to draw variables instead of text. I have all of that done and it works fine, however, I have 5 individual buttons that all have different values for this variables. I currently have 4 of those towers set with btn_tower_laser as their parent, but no matter how much I try, I can't get them to all draw the different variables. Can I have some help on this?
Parent Draw event:
// Draw the sprite and the required price
if image_index = 1
var width, height, range, rate, damage, name;
range = 200;
rate = 3;
damage = 10;
name = 'Laser';
width = sprite_get_width(sprite_index)/2;
height = sprite_get_height(sprite_index)/2;
if mouse_x>x-width and mouse_x<x+width and
mouse_y >y-height and mouse_y<y+height
draw_text(400,32,'Damage: '+string(damage)+' HP');
draw_text(400,64,'Fire rate: '+string(rate)+' shots/second');
draw_text(400,80,'Selling price: '+string(floor(price/2)));
You can't reference the variables of an Object - because it doesn't exist. Think of an Object like a definition/class - an abstract idea. An instance is a realization of that idea. You need to create an instance of an object in order to use it. You then access the instance's variables - not the Objects.
Ah, so should I have a separate object like the controller that defines ALL variables for things like price etc?