How do I use the draw_sprite() function?


So I went through the documentation, and found out that what you're supposed to do is this:
draw_sprite(sprite goes here, the frame of the animation goes here, x coordinate, y coordinate)
So I tried it with the following code written in a level manager that I created for the tutorial here (I just wanted to figure out how the function worked): 1626934533160.png I then ran my code and the sprite I'm trying to display is nowhere to be found(supposed to be a black spider, there's one for the player object that I moved offscreen with player controls, but the one that draw_sprite is supposed to create is nowhere to be found):
1626934796607.png I figured it could possibly be behind the tileset that I had placed in the room, so I figured I would try it in a separate project to see if that could get me any info on how that would work. The same call of the function from an object placed in the room yielded no results:
Image to go with it:
Literally just a blank room with nothing in it. What am I missing?


You are missing the fact that all draw functions can only go in the DRAW event. :) In your screenshot you have the draw function in the STEP event.
Thanks! This fixed the problem of it not displaying. However, is there a way to change what layer the draw command is drawing to?

Basically what I'm trying to do here is create a map of tiles that is about 500x500 tiles. Also, they need to be randomly generated. Unfortunately, displaying hundreds of instances of a tile object every frame is extremely taxing on computing resources. I don't really know how to integrate random generation with the tilemaps, especially as the tilemaps normally have their tiles painted on manually, so I figured I would use an array in order to store the tiles and then reference that map in order to do the tiles instead. As a result, what I'm looking for is a way to have a draw command write to a background. Is there a way to make something like this:
Player layer
Enemy layer
Tilemap layer(using draw commands so I don't have to use computationally expensive objects)
Background layer?

Computers start indexes at 0, I assume you want the first frame of spr_tileFloor, that'd mean your line of code would have to be
I figured it started at 0, but as part of my troubleshooting when I was looking at framedata as I thought I was maybe using an empty frame it said I was on frame 1, so I thought it was possible that the frame started from 1 instead of 0 as an exception to the rule. The 1 is left over from that thought process. I appreciate the thought though!