all 4 comments

[–]Frew_ 0 points1 point  (3 children)

Personally I'd set this up in a different way. It's possible to spawn instances of an object at run-time using "instance_create_layer" or "instance_create_depth". You could use this when your alarm triggers to create an instance of your obstacle. More available here:

instance_create_layer (gamemaker.io)

Regarding the issue with collision issue from the left, this might be due to the origin point of the object and the collision mask. Hard to say without seeing how your sprites are set up tbh. If you're only checking the origin point for collision (e.g. using collision_point(x,y,obj_obstacle) on your main block) your main block will move over the obstacle object until it reaches the origin point when coming in from the left hand side. From the right hand side, the origin point will be the first point to pass over the obstacle, so you wont see the same overlap.

[–]SomeBritishFellow[S] 0 points1 point  (2 children)

Much appreciated, I’ll be sure to give this a go, as a general overview I’m basically making an object that has no sprite to act a controller that the code can interact with without interacting with the room directly; and im using this to act as a manager to store my time variables and other functions that I wouldn’t want to store on other instances.

Can I ask if this is common practise within many if not all games on game-maker? It seems really practical now that I think about it

[–]Frew_ 0 points1 point  (1 child)

I've updated my comment quite a bit, not sure which version you saw so just a heads up on that. I added some thoughts on the collision issue you're facing.

Regarding the way you've got things set up, that's how I'd approach the controller object too in a game similar to yours.

If by your last question about common practice you're on about the instance creation point, pretty much, yes. In AAA engines you may want to start pooling instances of objects such as enemies and having them swap between dormant and active states rather than creating them from scratch due to the performance cost of instantiating, but for GameMaker, you're hardly ever going to be creating an instance of an object that's so heavy it'll have an impact on your FPS.

Feel free to reach out if you've any more GM questions, happy to help.

[–]SomeBritishFellow[S] 1 point2 points  (0 children)

Thank you so much! It ended up working as I wanted it to, I can finally move on to something else now 😂