• 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!

GML Physics game 2 questions

I am making an Android game. Physics , platform war game. (Sorry for my bad English) I have 2 problems :

1- When I click anywhere, the gun will fire there. Bullet is physics object. How do I get the bullet to go where I clicked and return to it?

2- A physics object is following a different physics object. I made it like this :
step event :
phy_position_x = DifferentObject.x
phy_position_y = DifferentObject.y
But there's a delay when it follows. How can I ensure that it follow it at the same time?

Thanks in advance :)
 

PNelly

Member
The physics and non-physics systems often don't get along well if you mix them. Give this a try:

phy_position_x = DifferentObject.phy_position_x;
phy_position_y = DifferentObject.phy_position_y;
 
Thanks but it didn't work. Physics object or not , Game maker always has got a delay . How i make it , i dont know. In the meantime, if someone knows, can they answer the first question? :) Thanks :)
 

Bart

WiseBart
For your first question, it should be a matter of applying the right force in the right direction. What do you mean by "return to it"?

For your second question, you should be able to simply link the two objects together using a distance joint with a distance of 0.
That would be the 'clean' way to do it and should get rid of that delay, since setting the phy_position_x and phy_position_y directly isn't really recommended (see remark #5 here: https://docs.yoyogames.com/source/dadiospice/002_reference/physics/index.html)
 
Top