Dies ist eine alte Version des Dokuments!


Simple Platformer

Kurz erklären was man in diesem Tutorial lernen kann

„In diesem Video lern ihr wie ihr ein eigenes Jump & Run in einer kostenlosen Gameengine baut.“

Godot Installiertes Godot 4.x. Ich entwickle hier auf der aktuellen Version 4.5 aber das Tutorial ist auch auf jeden anderen 4.x Version durchführbar

Projekt braucht eine leeren Ordner

Windows > Size > Width 480 Windows > Size > Height 270 Windows Width Override: 960 Windows Height Override: 540

Stretch > Mode Viewport Stretch > Aspect: keep

Rendering > Textures > Default Texture Filter: Nearest

Vielleicht später

Unter Input Map erstellen wir neue Input Aktionen Left, right, jump Für WASD-Steuerung und Cursor-Tasten

  • CharacterBody2D
  • AnimatedSprite2D
  • CollisionShape2D

Spritesheet 8 x 10 Sprites 32 x 32

  • Staticbody2D
  • Collisionshape2D > RectangleShape
  • TileMapLayer-Node erstellen
  • TileSet erstellen
  • Physics Layer erstellen > CollisionShapes
extends CharacterBody2D

const GRAVITY = 8.1
const SPEED = 50
const JUMP_VELOCITY = -150  


func _physics_process(delta: float) -> void:
	if Input.is_action_pressed("left"):
		velocity.x = -SPEED
		$AnimatedSprite2D.flip_h = true
		$AnimatedSprite2D.play("run")
	elif Input.is_action_pressed("right"):
		velocity.x = SPEED
		$AnimatedSprite2D.flip_h = false
		$AnimatedSprite2D.play("run")
	else:
		velocity.x = 0
		$AnimatedSprite2D.play("idle")
	
	if Input.is_action_just_pressed("jump") and is_on_floor():
		velocity.y = JUMP_VELOCITY
		
	velocity.y += GRAVITY
	move_and_slide()
  • projects/simpleplatformer.1760102623.txt.gz
  • Zuletzt geändert: 2025/10/10 15:23
  • von silversurfer