• Hey! Guest! The 39th GMC Jam will take place between November 26th, 12:00 UTC and November 30th, 12:00 UTC. Why not join in! Click here to find out more!

Help [Solved]

A

Amoses

Guest
I am currently making a game where you are a player in a room full of plates, and you click to move, and im trying to make it so whenever you click on a plate you move to that plate, but for some reason whenever i move to one its just sticking to that one and not being able to move to a different one
 

Yal

🐧 *penguin noises*
GMC Elder
Here's some ideas
  • Do you ever STOP moving to a plate once you start? Maybe the player still is moving to the first plate
  • Do you move to the ID of the clicked plate or just "obj_plate"? If you use the object name, you always move to the same (the first one), if you use IDs you can move to any.
We're not mind readers, so please show us your code.
 
A

Amoses

Guest
Here's some ideas
  • Do you ever STOP moving to a plate once you start? Maybe the player still is moving to the first plate
  • Do you move to the ID of the clicked plate or just "obj_plate"? If you use the object name, you always move to the same (the first one), if you use IDs you can move to any.
We're not mind readers, so please show us your code.
haha sorry
Code:
 if mouse_check_button_pressed(mb_left) && postion_meeting(x,y,ObjectName)
x = object.x
y = object.y
i have different objects for each plate
 

Yal

🐧 *penguin noises*
GMC Elder
You need to block the stuff together, right now only the x bit is conditional... the y bit always is run.
Code:
if mouse_check_button_pressed(mb_left) && postion_meeting(x,y,ObjectName)
{
          x = object.x
          y = object.y
}
 
A

Amoses

Guest
You need to block the stuff together, right now only the x bit is conditional... the y bit always is run.
Code:
if mouse_check_button_pressed(mb_left) && postion_meeting(x,y,ObjectName)
{
          x = object.x
          y = object.y
}
ohhh okay, thank you! i will go test this now
 
A

Amoses

Guest
You need to block the stuff together, right now only the x bit is conditional... the y bit always is run.
Code:
if mouse_check_button_pressed(mb_left) && postion_meeting(x,y,ObjectName)
{
          x = object.x
          y = object.y
}
it still doesnt work, I have the second plate so if the player is on it, it hurts the player, and everytime i click it its hurting the player, but not going to the plate
 
A

Amoses

Guest
You need to block the stuff together, right now only the x bit is conditional... the y bit always is run.
Code:
if mouse_check_button_pressed(mb_left) && postion_meeting(x,y,ObjectName)
{
          x = object.x
          y = object.y
}
ohhhhhh its working now, but its only because I deleted the collision with the plate that does damage? how do i fix that?
 

Yal

🐧 *penguin noises*
GMC Elder
ohhhhhh its working now, but its only because I deleted the collision with the plate that does damage? how do i fix that?
Make it non-solid. If either object involved in a collision is solid, the objects are moved to the previous position before the event resolves.
 
Top