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

Game Mechanics Player static in infinite room

L

Lo_Z

Guest
Hi guys! I'm new, so I'm sorry if i'm in wrong place.

My problem is that: I wanna have a spaceship that stand at the centre of the room and don't move, but all objects around it do, giving the feeling of motion. That's can't be a problem by setting speed and direction to the objects opposite to the ship, but i wanna do it in a physic room. So.. how i can do?
 
T

T. Brugel

Guest
Well you could move the x and y positions of the objects, although with physics they arent called 'x' and 'y' but phy_position_x and phy_position_y
 
T

T. Brugel

Guest
Code:
var xSpd = lengthdir_x(speed, direction);
var ySpd = lengthdir_y(speed, direction);
phy_position_x += xSpd;
phy_position_y += ySpd;
This code should be placed in the step event of the objects, and this would make the speed and direction work again like normal
 
L

Lo_Z

Guest
Code:
var xSpd = lengthdir_x(speed, direction);
var ySpd = lengthdir_y(speed, direction);
phy_position_x += xSpd;
phy_position_y += ySpd;
This code should be placed in the step event of the objects, and this would make the speed and direction work again like normal
Thank you, I'll try.

You can just move the player ship and forget about there being a room.
I know, but when I reach the edge of the room the camera will stop moving letting the ship disappear or jump to the opposite side. And I wanna avoid this.
 

Smiechu

Member
Thank you, I'll try.


I know, but when I reach the edge of the room the camera will stop moving letting the ship disappear or jump to the opposite side. And I wanna avoid this.
Not if you set the camera position manually with camera_set_view_pos
 
Top