no physics objects in physics room

M

mr_starfire

Guest
Hi guys i have a car object that is not a physics object and i know that i have to manualy create collisions with physics objects but before i get to that problem i have the problem which is as follows

the car objects code simply does not work in a physics room even if it is set to not a physics object so i cannot troubleshoot the next issue
 
M

mr_starfire

Guest
the code that does not work if i set the room to physics room is this


image_angle = facing_direction
{
if
keyboard_check(vk_left) || (gamepad_axis_value(0,gp_axislh)< 0) && steerable = 1
facing_direction+=7
}
{
if
keyboard_check(vk_right) || (gamepad_axis_value(0,gp_axislh)> 0) && steerable = 1
facing_direction-=7
}
if
keyboard_check(vk_up) || gamepad_button_check(0,gp_shoulderrb)
motion_add(facing_direction,+2)
friction = 0

if
!keyboard_check(vk_space)
friction = 0.6

if speed >17 speed =17

if
keyboard_check(vk_down) || gamepad_button_check(0,gp_shoulderlb)
friction +=0.8



the left right buttons rotate the sprite regardless of speed and the object will not move forward in direction
 

Jezla

Member
It looks like it should work, but I'm confused why you need to set the room to be a physics room when this is not a physics object. If you're using physics, you should make this a physics object and move it using forces and impulses. Otherwise, do as it says in the manual:

  • The physics system replaces many of the normal instance functions... for example, rather than set a speed and a direction for an instance, if it has been declared as being a fully simulated physical body, you would use a force or impulse to get it to move around in the game world, or if it is not physics enabled you will need to set the x an y positions yourself. This takes a bit of getting used to, so experiment with the physics functions and get to know how everything works before trying to integrate them into your project.
You'll need to alter your code so that you're adjusting the x and y directly without using the built-in properties or movement functions.
 
M

mr_starfire

Guest
thanks for your help jezla i think im going to leave this aspect of the game as it was only an after thought hence the reason i was trying to implement it into a non physics. System im not great at code and trying to implement this small function which i was only going to use in one mini game is not going to be a great use of time .. thanks a bunch tho

p.s cave lander rocks :)
 
Last edited by a moderator:
Top