Sawyer
Member
Hello everyone,
I work on a little RTS.
Actually i move my unit with my mouse (right click). If my unit meet a wall it stop moving. i wrote a simple piece of code to do that.
In global right pressed :
In an event collision with obj_wall :
However this code it too basic, i will need to find a better way to have collisions beacause i will work with more than 50 units further my collisions aren't good enough, sometimes i have a space between my obj_wall and my unit.
And also when i click many time on the other side of the wall my unit cross the wall step by step.
I tryed to create a script, but everytime my unit crossing my wall without stop.
Any ideas to please?
I work on a little RTS.
Actually i move my unit with my mouse (right click). If my unit meet a wall it stop moving. i wrote a simple piece of code to do that.
In global right pressed :
Code:
if (selected == true)
{
if (place_free(mouse_x, mouse_y))//if there are no obstacles at this point
{
xx = mouse_x;//get x
yy = mouse_y;//get y
moving = true;//start moving
instance_create(xx, yy, obj_goto);//create animation
}
}
Code:
moving = false
And also when i click many time on the other side of the wall my unit cross the wall step by step.
I tryed to create a script, but everytime my unit crossing my wall without stop.
Any ideas to please?
Last edited: