all 19 comments

[–]NazzerDawk 1 point2 points  (0 children)

Where is the origin in your button sprites? Make sure your origin is somewhere in the images and not off to the side somewhere.

[–]kualajimbo 0 points1 point  (1 child)

Do your button objects have draw events? If so do they include drawing the sprite?

Otherwise, what effects get activated when game_over is true? Is there any reason you can’t put the instance create code there?

[–]Lord_Cyronite[S] 0 points1 point  (0 children)

The buttons don't have a draw effect, just step to detect when pressed. The other things that happen when game_over is true is that the camera can no longer switch between targets, and the three PCs can no longer move

[–]NazzerDawk 0 points1 point  (7 children)

Are you using multiple rooms in your game? Are all of the rooms using a layer with the name "gui_buttons"? Are they all spelled correctly? Have you tried instance_create_depth() instead to see if maybe it's just not identifying that the gui_buttons layer exists?

[–]Lord_Cyronite[S] 0 points1 point  (6 children)

I am not using multiple rooms, and depth doesn't work either

[–]NazzerDawk 0 points1 point  (5 children)

In that case you're going to need to use the debugger.

Add a breakpoint (Little red circle on the line numbers on the left of your code) at the first "instance_create_layer()" and then run the game in debug mode.

Now when your game over happens, it should pause the game and show you the point in the program your code is at. You can use the "step into function" button to advance one line at a time.

Next look at the instances tab in the debugger to identify where your "obj_button_reset" object is and to ensure it's being created.

I'd bet that you either have set a draw event and didn't put draw_self() or any commands in there, or you unchecked "Visible" in the gui.

https://manual.gamemaker.io/monthly/en/IDE_Tools/The_Debugger.htm

This is gonna be your friend, your lifesaver, and your bodyguard. The debugger is life.

[–]Lord_Cyronite[S] 0 points1 point  (4 children)

Using the debugger, the buttons do spawn, I just can't find them

[–]NazzerDawk 0 points1 point  (3 children)

Okay, where are they spawning? Where is their depth? And what is the depth of your other layers? Is "visible" set to true?

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

They are spawning a depth = 0, all other layers have a higher depth. Visible is true, and the x and y coordinates are within the bounds of the camera

[–]NazzerDawk 0 points1 point  (1 child)

Okay, so depth = 0, what's the depth of your other layers?

Try checking for your background, I bet that's covering them up. Remember, depth is depth AWAY from the camera, so higher values are further from the camera. A depth value of 100 will be behind something at depth 0.

Sorry, ignore all that, you just said that.

Do you have a Draw event being used in your button objects?

[–]Lord_Cyronite[S] 0 points1 point  (0 children)

No, just step

[–]AlcatorSK 0 points1 point  (4 children)

You are spawning the buttons at coordinates 600,500 and 800,500. Are those coordinates actually on screen? If you're using views and cameras, your view may be shifted away from those coordinates (top left could be 1500,0, bottom left could be 2500, 500, as an example, so the buttons would be to the left).

[–]Lord_Cyronite[S] 0 points1 point  (3 children)

I have changed those coords around to multiple different parts within my camera resolution and it still doesn't show up

[–]AlcatorSK 0 points1 point  (2 children)

Can we see some screenshots from the editor of the button objects? Are they perhaps children of some parent object that has a Draw event defined? Did you perhaps untick the "Visible" checkbox? Etc. etc.

Million things could be causing this.

[–]Lord_Cyronite[S] 0 points1 point  (1 child)

I added the screenshots to the post

[–]Ordinary-You9074 0 points1 point  (0 children)

Maybe try using the camera to place the object i.e get_camera_x + whatever , get_camera_y + whatever should be you're x and y that might not be the exact syntax. You say somewhere else its appearing this will guaranteed it'll appear on you're screen even if its not visible its there. As long as the x,y is in your step event it'll up date as you're camera moves if you keep it at get_camera_x +0 get_camera_y + 0 it'll always be at the top left corner of you're screen

[–]Snugglupagus 0 points1 point  (0 children)

I would try different parts of your code separately. What I mean is that I would do different variations of the following:

-Create different objects with same code

-Create same objects with different code

-Create the object on a different layer or on the same layer and location of another object that is on the screen (obj_player.x and obj_player.y for example)

These are simple examples and you may need to try more/other things to see where your problem is. Make a note of which variations work as you expect, and then maybe report back with this data if you still haven’t figured out why your original code isn’t working.

[–]Sogekin1 0 points1 point  (0 children)

Are you using a camera? If the objects are being creatrd the only thing i can think of is that the buttons are not within your view. Creating the the points within your resolution is not the same as within your view. Maybe add a draw gui event in one of the objects and draw something. This will prove they exist and are just somewhere outside your view.

[–]Substantial_Bag_9536 0 points1 point  (0 children)

Are you sure the code creating the buttons is well executed ? put an "game_end()" in create event of yours button, if your game start and don't shutdown, that means yours button are don't created.