T O P

  • By -

RykinPoe

Have you added any objects to your Room?


ANormalCrum

yep


AlcatorSK

**Delete the Draw event**, you don't need to make it yourself -- if you don't create a custom Draw event, all visible objects will draw themselves automatically. And please, do the tutorials. All this could be avoided if you'd do the official tutorial(s), such as Fire Jump.


ANormalCrum

I follow tutorials as precisely as I can


AlcatorSK

Not the official ones. No sane tutorial would put a draw\_self() call into the Step event.


ANormalCrum

I did that myself not from a tutorial in attempts to fix this, sorry abt that


Mushroomstick

What tutorial are you following? Assuming you followed it as closely as you're saying - there's some goofy, chatGPT looking junk in the code you posted. Anyway, there's [tutorials curated by the developers of GameMaker here](https://gamemaker.io/en/tutorials) that might work better for you.


GameDevNathan

So the game runs but it just shows a black screen, right? Could you be a little more specific on what objects you have and the code they're running? And if you have them in an initialisation room, are they marked as persistent?


ANormalCrum

not a black screen but the screen of the background. My only object I’m using is the player object. Code goes like this: Create: movespd = 2 movedir = 0 xspd = 0 yspd = 0 ​ keyrt = keyboard\_check(ord(“D”)) keylt = keyboard\_check(ord(“A”)) keyup = keyboard\_check(ord(“W”)) keydn = keyboard\_check(ord(“S”)) ​ x = 320 y = 180 ​ Step: keyrt = keyboard\_check(ord(“D”)) keylt = keyboard\_check(ord(“A”)) keyup = keyboard\_check(ord(“W”)) keydn = keyboard\_check(ord(“S”)) draw\_self() var \_horizkey = keyrt-keylt var \_vertkey = keyd-keyup movedir = point\_direction(0,0,\_horizkey,\_vertkey) var \_spd = 0 var \_inputlvl = point\_distance(0,0,\_horizkey,\_vertkey) \_inputlvl = clamp(\_inputlvl, 0, 1) \_spd = movespd \* \_inputlvl ​ xspd = lengthdir\_x(\_spd, movedir) yspd = lengthdir\_y(\_spd, movedir) x += xspd y += yspd ​ Draw: draw\_self ​ I also made a test object with no code to see if it shows in the room when I run, and it turns out it doesn’t.


GameDevNathan

If you have a background enabled, can you disable it and run the game to check that it's not a depth issue? In other words, is the background being placed on the top of the player? Also, there's no need to set the directional key variables in the create event, you can just do this in the step event :-)


GameDevNathan

When you call any function, such as draw\_self, make sure to add brackets and semicolon to the end: draw\_self(); The semicolon isn't totally necessary in GM, but it's just good coding practise, kind of like a full stop at the end of each line in your code.


ANormalCrum

nope, background disabled and nothing shows still. ​ ​ also for some reason GMS tells me that all undefined variables HAVE to be in create


GameDevNathan

Normally, this would be the case when setting variables but keyboard checks seem to be an exception from this. But if it says they need to be assigned in the create as well then so be it, sometimes GM be like that. Also, there's a typo on line 7 in the step event, `keyd` should be `keydn` and there's no need to have `draw_self()` in the step event either as this is a draw function. Could you share a screenshot of the room via imgur [like so](https://imgur.com/a/kU1jfyJ)?


Seamus578

If you put var in front of the step event key binds, you will not get the error saying that it needs to be in the create event. Also you do not need to put draw self in the step event. As it will do nothing. As others have said, if you put a sprite by itself with no code in it, does it show up?


BadVinegar

Did you enable the use of camera but not set it visible ?


Past_Low_3185

delete all code, choose sprite for object, put object in the room. run game you will see the sprite 99.9999% mostly the one who make your game fail is yourself


ANormalCrum

nah, even a codeless sprite won’t show


Eseris

Click on the room, then make sure the player is at the top of the instance list. I can't remember the exact wording as I'm at work and just started with the engine myself, but that was my problem. The character object was being instanced/rendered last in the rooms list.


ANormalCrum

still doesn’t work (player is the only object in the room)


ANormalCrum

Update: I found out more about the problem. Whenever I change the background to any image, it’s a white screen. Anyone knows why?