Unable to set phy_bullet to true, please help!

K

kuthedk

Guest
I keep getting these errors and I just don't know whats causing them. I'm new here to the forum and I hope I'm posting this in the correct location... thank you very much in advance!


Code:
_________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Create Event
for object Orb:

Pop :: Execution Error - Variable set failed phy_bullet - read only variable?
 at gml_Object_Orb_CreateEvent_1 (line 6) - phy_bullet = true;
############################################################################################

code:

// Initialize the Orb
draw_self();
damage = choose (2, 2.5, 3);
creator = noone;
knockback = 10;
phy_bullet = true;
if (grid_place_meeting(Orb.x, Orb.y)){
    instance_destroy();
}

And when I comment out the phy_bullet = true; I run into another bug

_________________________________________
############################################################################################
ERROR in
action number 1
of  Step Event0
for object Player:

The instance does not have an associated physics representation
 at gml_Script_scr_attack_state (line 8) -   physics_apply_impulse(x, y, xforce, yforce)
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_scr_attack_state (line 8)
called from - gml_Script_scr_move_state (line 21) - scr_attack_state();
called from - gml_Object_Player_StepNormalEvent_1 (line 3) - script_execute(state);

code:

///scr_attack_state
if (Player.attack){
    var p = instance_create(x, y, Orb);
    var xforce = lengthdir_x(20, face*90);
    var yforce = lengthdir_y(20, face*90);
    p.creator = id;
    with (p) {
        physics_apply_impulse(x, y, xforce, yforce)
    }
}
 

Bingdom

Googledom
The room has to be a physics world, (Which you can get by going into Room -> Settings -> Physics) I believe for phy_bullet to work.

Look at the error message
The instance does not have an associated physics representation
Make sure 'object player' is a physics object.

Remember, physics functions are very different to normal functions. ;)
 
Last edited:
Top