Quantcast
Channel: Active questions tagged game-maker - Stack Overflow
Viewing all articles
Browse latest Browse all 189

GUI will only Work for Newest Towers and I Don't Know Why. (Gamemaker)

$
0
0

I have a problem where in a game. when I make in a place the first tower the GUI works fine, but when I place the second tower the GUI only works for that second tower, and it just goes on and on for each newest tower my place.

Step Event:

if placed != false{    image_alpha = 1;    if collision_circle(x,y,200,oEnemy,false,true)    {        if instance_exists(oEnemy)        {            target = instance_nearest(x,y,oEnemy)            if target.x < x            {                direction = point_direction(x-18,y,target.x,target.y);            }            else            {                direction = point_direction(x+18,y,target.x,target.y);            }            if alarm[0] = -1            {                alarm[0] = 60;            }        }    }    if mouse_check_button(mb_any)    {        if !position_meeting(mouse_x,mouse_y,self)        {            GuiOpen = false;        }        else        {            GuiOpen = true        }    }}else{    x = mouse_x;    y = mouse_y;    image_alpha = 0.5;}if GuiOpen = true{    instance_create_layer(x,y-65,"Instances2",o_Tower1Upgrade);}else{    instance_destroy(o_Tower1Upgrade);    instance_destroy(o_tower1upgradebutton1);}

I tried my best to figure out the bug but i really just can't, theres no errors in the output or anything i could find thats wrong with my code.


Viewing all articles
Browse latest Browse all 189

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>