• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

How to sort out priority in a game (on the map)

T

Teijal

Guest
Hi guys,

I've come across an issue: I want to have two objects that surround the map that need to be unpassable, but I don't know how to set priority or how to make something unpassable. Does anyone know?
 

samspade

Member
Hi guys,

I've come across an issue: I want to have two objects that surround the map that need to be unpassable, but I don't know how to set priority or how to make something unpassable. Does anyone know?
We would probably need to know more. For example, how are your collisions set up in general? How is your movement set up? Seeing the code for that would likely get a better answer. However, the start of your question - objects that surround the map, also make me think that maybe you want some kind of border, that might be easier to do just by clamping (see the clamp function in the manual) the x and y values of whatever object you want to the room boundaries (e.g. 0 and room_width for x and 0 and room_height for y).
 
T

Teijal

Guest
clamp(ev_boundary,800,1000)

That's the code I have currently. When I place ev_boundary in front it doesn't start. My width is 900 and height is 1000, I tried a bunch of variations but they don't work.
 
T

Teijal

Guest
if (x <= 600) x = 600;
if (x >= room_width - 600) x = room_width - 600;
if (y <= 500) y = 500;
if (y >= room_height - 500) y = room_height - 500 ;

or this,

x = clamp(x, 500, 900);
y = clamp(y, 600, 1000);
 

chamaeleon

Member
clamp(ev_boundary,800,1000)

That's the code I have currently. When I place ev_boundary in front it doesn't start. My width is 900 and height is 1000, I tried a bunch of variations but they don't work.
I think this is the second post I've seen you use one of the ev_ constants in a completely wrong manner. You should read the manual again (you did read it before right?) to pick up on the basics. You are fumbling in the dark if you randomly pick using something like ev_boundary is a clamp expression. It makes zero sense.
 

samspade

Member
if (x <= 600) x = 600;
if (x >= room_width - 600) x = room_width - 600;
if (y <= 500) y = 500;
if (y >= room_height - 500) y = room_height - 500 ;

or this,

x = clamp(x, 500, 900);
y = clamp(y, 600, 1000);
Either of those should work, and that is the proper use of clamp (the first post was not as chamaeleon noted). Are you saying you tried those and those also did not work? If so, then I would check to see whether the code is running or whether there is anything interfering with it.
 
Top