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

Legacy GM Coding Problem - obj_playmir code doesn't properly imitate obj_player?

P

Pyrolex

Guest
So, yesterday I experimented with some code for a small game I'm working on, and the code is supposed to make a "mirror copy" of the player imitate the player. For the most part, the code works, but I'm having difficulties with the jump for the mirror player (let's call it "playmir"). See, when I press the Jump button (which I've bound to the up arrow key), obj_player jumps perfectly fine. However, obj_playmir does not properly jump. He does jump, sort of, but pressing the Jump button makes obj_playmir suddenly ignore the gravity I've set for him, and when he reaches the peak of his jump, he doesn't gravitate back towards the platform, he flies off-screen and into oblivion. I've asked a bunch of friends on Discord about it, and despite all their knowledge of GM:S, none of them seem to know what's happening.

If it helps, I have screenshots of the two codes.

"Step" code for obj_player:


"Step" code for obj_playmir:

(I have the hsp in the "create" code set to 4, and the vsp for player is 7, while playmir's is -7; grav for player is set to 0.2, and playmir's is -0.2)
I tried reversing playmir's gravity back to 0.2, but not even that works. I'm so close to perfecting the code, but I can't even get gravity for playmir to work; what am I doing wrong?
 

NightFrost

Member
Playmir will substract negative gravity from vsp once it goes above 10, meaning it will start increasing towards positive indefinitely.
 
try to put keyboard_check_pressed, or if you want to stay in air while jump button say, and I will write an altgorithm and make something more easy, and more efficient
 
Top