I HAVE done this before, so if you run into trouble, I'd recommend asking about it in the help channels of the GM Discord. You simply want to change how your collision checking is done, which is the easier part to handle. This is the difference between "collision checking" and "collision handling". The result is still the same: there is something there, or there isn't. So replace place_meeting() with place_meeting_z: a script of your own making, that accepts a z axis and makes all the necessary checks including a z-axis. So all you really want to do is add another variable to the check: z. "There is something there? I can't move." "There isn't? I can move." When we say "place_meeting()" we are basically asking "is there a collision here or not." And then we handle the result of that. The Lazer object needs to be destroyed when it leaves the room, otherwise it will still be active in memory and use up computer memory.So this is something I've been meaning to write an article about, but think about it like this. change y-= to x+= to make the lazer shoot to the right Add a Step Step event to the lazer object and add this code to move the lazer: //minus from the y axis makes the lazer go up the room.change the value to make the lazer shoot faster Add a Create event to it with this code: //speed of the lazer, increase this number to make player shooting faster.Name it objPlayerLazer and associate it with the sprite you create above.Right click Object and click Create Object.When we create the lazer object in the game, we need it to spawn from this point so it looks like it is coming from the player object. Set the Origin of the sprite to Bottom Centre.Click the Import button and import your bullet or lazer GIF or PNG file.In the Assets Browser Resources menu (usually located on the right side of GameMaker studio 2) In this tutorial we will step through how you setup your player object to shoot lazers or bullets in GameMaker Studio 2 Create the player’s lazer / bullet sprite Tutorial 5: Making your player shoot in GameMaker Studio 2
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |