Here in this lecture, we'll make our player shape. I'll start by creating a new project. I'll select drag and drop and call the project space shooter. Now first of all, I need to import a Sprite. So I'll create a sprite resource and call it as player. I click on imports to import the player image.
And now let me tell you about sprite origins. The origin is basically the point in a sprite where the objects x and y coordinates are and the sprite rotates from that point. Right now it's set to top left but we need to make it middle Center. This way the x&y coordinates will be at the sprite center and if we rotate it, it will rotate from the center Boyd. Now we'll create an object for it and call it a player. I'll assign the sprite.
Now one other creative word in this event are the assigned variable action I'll create a variable called movespeed X and set it to eight. So this is the movement speed for the x axis only, which controls the left and right movement. Now click on the plus sign here to create another variable and name it move speed y, I'll set it to five. This is the movement speed for the y axis only which controls are up and down movement. So as you can see, in this game, we're going to have different speeds for the horizontal and vertical movement, the player should be able to move left and right faster than they can move up and down. Now we need to set up the arrow key events.
So first, I'll add the key down left event. In the actions ulcers jump and add the jump to avoid action. To move left, you subtract from x soil set x to relative and type minus movespeed x. Now we'll add the key down right around. I'll add the jump to board action side extra relative and I've moved speed x. So now the player ship can move left and right now under the key don't up event, I'll add the action set wide world And I've minus movespeed.
Why so this will move it up, I'll add the key down down event, I'll add the actions at White relative and type movespeed y. So now the ship can move up and down as well. Now I'll open the rule. You can change the size of the room here if you want, I'm going to keep it at the default size. So I'll place a play object in the room. And now I run the game.
You can see that I'm able to move around and that I move faster horizontally and slower vertically. Now let's move on to the next lecture we will implement a room boundary