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

X,Y position in View?

Jonno

Member
Is there any way to get the x,y position of an object within a view rather than the whole room?
I've written some code where the jump sound pitch alters with the height position of the player

jumpSound = view_hview / y / 3

if (isJumping) || (isFalling)
{
audio_emitter_pitch(audioEm, jumpSound)
audio_play_sound_on(audioEm, sndJump,false,10);
}

This code used to work great when I had the game set in different rooms, but I've since decided to make it 2-player split screen, and obviously I've had to merge all rooms into one large one.

The problem is now, that the y value of the player can get extremely low, due to the lowest value of the room's y.

Any thoughts?
 
B

BeastyBoy

Guest
player_x_in_view=player.x-view_xview
player_y_in_view=player.y-view_yview
 
Top