E
EAT_DIRT
Guest
I am working on a Multiplayer platform game that utilizes various choices of weapons and characters. When the player attacks, the weapon mask creates itself and follows the players movement. However, when I draw the sprite of the actual weapon it stays in the same spot from when the action was executed.
The Mask's Creation Event
The Mask's Draw Event
If I were to remove the "sprite_index" from the creation event; the mask is drawn and it follows the player like I mentioned above. If I try to add a sprite to the mask's index, it does not work. Or, if "obj_player_self" is changed to "other.id", it wont recognize the "weaponA_var" variable and I will get a FATAL ERROR saying "not set before reading it"
Also, if multiple players(player1 and player2) were in the same room and I change "other.id" to "obj_player_self" in the draw event; it will only spawn next to player 1.
////////////PARENT OBJECTS FOR REFFERENCE
OBJ_PLAYER_1 < weaponA_var = spr_weaponA
OBJ_PLAYER_2 < weaponA_var = spr_weaponA
OBJ_PLAYER_SELF////PARENT OBJECT
////////////////////////////////////////////
OBJ_WEAPON_MASK
OBJ_PLAYER_HITBOX_PARENT //////// PARENT OBJECT
The Mask's Creation Event
Code:
////Creation Event
sprite_index =obj_player_self.weaponA_var
The Mask's Draw Event
Code:
////DRAW EVENT
self.x = other.id.x
self.y = other.id.y
draw_sprite(sprite_index,image_index,x,y)
image_xscale = other.image_xscale;
image_speed=other.image_speed
If I were to remove the "sprite_index" from the creation event; the mask is drawn and it follows the player like I mentioned above. If I try to add a sprite to the mask's index, it does not work. Or, if "obj_player_self" is changed to "other.id", it wont recognize the "weaponA_var" variable and I will get a FATAL ERROR saying "not set before reading it"
Also, if multiple players(player1 and player2) were in the same room and I change "other.id" to "obj_player_self" in the draw event; it will only spawn next to player 1.
////////////PARENT OBJECTS FOR REFFERENCE
OBJ_PLAYER_1 < weaponA_var = spr_weaponA
OBJ_PLAYER_2 < weaponA_var = spr_weaponA
OBJ_PLAYER_SELF////PARENT OBJECT
////////////////////////////////////////////
OBJ_WEAPON_MASK
OBJ_PLAYER_HITBOX_PARENT //////// PARENT OBJECT