T
Toxicosis
Guest
Hello,
I am a first-time user, I had a problem with my game.
I am currently prototyping (before going into an epic blood-pumping journey about the meaning of life, the universe, and everything, I'm making a game about a balloon that inflates and deflates when the player releases shift), and trying to allow the player to cycle between 2+ modes for the player. In order to do that, I created a parent, obj_player, and several child objects, each of which represents the player's current mode.
My question is, are create events inheritable? I placed an instance of the player's first mode in the room, and when I pushed SPC to shift to the second mode, it tells me the mode variable wasn't initialized, even though obj_player has a create event to do just that. That, despite giving the parent obj_player and the parent obj_walls a collision marker with each other worked just fine- albeit I had to comment it to get it to stick.
Here's a copy of the code I was using for the mode shifting. I apologize for the drag_and_drop thing, I'm kinda new to coding still.
======
======
If I don't uncomment the initializing of ready_baloon in the create event of obj_balloon_flat, the game stops working as soon as I release shift.
It's rather frustrating: I was hoping to initialize everything that doesn't change between modes at the parent. Does that mean I have to place a spriteless parent in the room, rather than a copy of balloon_flat, and give the parent the instructions to create the flat balloon to start the game?
Thanks in advance.
EDIT:
I tried to put obj_player in the room, but then the variables specific to obj_balloon_flat involved in its step event cause an immediate crash before it can even spawn the obj_balloon_flat. Is there a way to make sure the object is created BEFORE any step events take place? Or do I have to hold off the step event actions until there is an object created, by using instance_count?
I am a first-time user, I had a problem with my game.
I am currently prototyping (before going into an epic blood-pumping journey about the meaning of life, the universe, and everything, I'm making a game about a balloon that inflates and deflates when the player releases shift), and trying to allow the player to cycle between 2+ modes for the player. In order to do that, I created a parent, obj_player, and several child objects, each of which represents the player's current mode.
My question is, are create events inheritable? I placed an instance of the player's first mode in the room, and when I pushed SPC to shift to the second mode, it tells me the mode variable wasn't initialized, even though obj_player has a create event to do just that. That, despite giving the parent obj_player and the parent obj_walls a collision marker with each other worked just fine- albeit I had to comment it to get it to stick.
Here's a copy of the code I was using for the mode shifting. I apologize for the drag_and_drop thing, I'm kinda new to coding still.
======
Code:
Obj_Player:
Create Event:
Set Variable ready_baloon to true
Execute a piece of Code
[ready_baloon = true]
Release [Shift]:
If ready_baloon is equal to true
Start of a Block
If inflated is equal to false
Start of a Block
Create instance of obj_balloon_inflated at relative position (0,0)
Destroy instance
Comment: Setting variables is best in the object itself.
End Block
Else
Start of a Block
Create instance of obj_balloon_flat at relative position (0,0)
Destroy Instance
End of a Block
End of a Block
Obj_Balloon_Flat
Create Event:
Execute a piece of code
[inflated = false;
//ready_baloon = true]
If I don't uncomment the initializing of ready_baloon in the create event of obj_balloon_flat, the game stops working as soon as I release shift.
It's rather frustrating: I was hoping to initialize everything that doesn't change between modes at the parent. Does that mean I have to place a spriteless parent in the room, rather than a copy of balloon_flat, and give the parent the instructions to create the flat balloon to start the game?
Thanks in advance.
EDIT:
I tried to put obj_player in the room, but then the variables specific to obj_balloon_flat involved in its step event cause an immediate crash before it can even spawn the obj_balloon_flat. Is there a way to make sure the object is created BEFORE any step events take place? Or do I have to hold off the step event actions until there is an object created, by using instance_count?
Last edited by a moderator: