Welcome to my Website!

Roger (aka SharpRabbit) Progammer/ Techinical Artist

My first lesson

This was made in Godot 4.2 and was written 12/17/23

Hello world, it seems whenever I start a new project, I always forget how to make the character move, so this would be my first lesson. That way when I forget again, I'll have this handy guide to refresh my memory



I made a little space shooter game to help me get into the swing of things. So this is for 2d movement and only goes left or right. velocity = transform.x * Input.get_axis("left", "right") * speed This is our engine so to speak, our velocity is needed for the next piece (the move and slide function). This code multiplies our x by either 1 or -1 (left or right) and then by our speed variable (which you can set to whatever). To get this actually moving make sure you put a move_and_slide() in a physics process function.

As a extra tip, when making the laser/ projectle I used position -= transform.y * speed * delta this moves the laser up (up is negative y in godot) at a speed we set over time, hence the delta.