Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
| projects:simpleplatformer [2025/10/10 15:12] – angelegt silversurfer | projects:simpleplatformer [2025/10/10 15:29] (aktuell) – silversurfer | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| ====== Simple Platformer ====== | ====== Simple Platformer ====== | ||
| + | ===== Teaser ===== | ||
| + | Kurz erklären was man in diesem Tutorial lernen kann | ||
| + | |||
| + | <WRAP round notice>" | ||
| + | |||
| + | ===== Voraussetzungen ===== | ||
| + | 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 | ||
| + | |||
| + | ===== Assets ===== | ||
| + | |||
| + | |||
| + | ===== Projekt erstellen ===== | ||
| + | Projekt braucht eine leeren Ordner | ||
| + | |||
| + | ===== Level erstellen ===== | ||
| + | |||
| + | |||
| + | ===== Einstellungen ===== | ||
| + | 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 | ||
| + | |||
| + | ===== Player erstellen ===== | ||
| + | |||
| + | * CharacterBody2D | ||
| + | * AnimatedSprite2D | ||
| + | * CollisionShape2D | ||
| + | |||
| + | ===== Assets kopieren ===== | ||
| + | |||
| + | ===== Animationen erstellen ===== | ||
| + | Spritesheet 8 x 10 Sprites 32 x 32 | ||
| + | |||
| + | ===== Profisorischen Boden im Level ===== | ||
| + | * Staticbody2D | ||
| + | * Collisionshape2D > RectangleShape | ||
| + | |||
| + | ===== TileMapLayer erstellen ===== | ||
| + | * TileMapLayer-Node erstellen | ||
| + | * TileSet erstellen | ||
| + | * Physics Layer erstellen > CollisionShapes | ||
| + | |||
| + | ===== Input Map ===== | ||
| + | <WRAP tip> | ||
| + | Unter Input Map erstellen wir neue Input Aktionen | ||
| + | Left, right, jump Für WASD-Steuerung und Cursor-Tasten | ||
| + | |||
| + | ===== Player Script ===== | ||
| + | |||
| + | < | ||
| + | extends CharacterBody2D | ||
| + | |||
| + | const GRAVITY = 8.1 | ||
| + | const SPEED = 50 | ||
| + | const JUMP_VELOCITY = -150 | ||
| + | |||
| + | |||
| + | func _physics_process(delta: | ||
| + | if Input.is_action_pressed(" | ||
| + | velocity.x = -SPEED | ||
| + | $AnimatedSprite2D.flip_h = true | ||
| + | $AnimatedSprite2D.play(" | ||
| + | elif Input.is_action_pressed(" | ||
| + | velocity.x = SPEED | ||
| + | $AnimatedSprite2D.flip_h = false | ||
| + | $AnimatedSprite2D.play(" | ||
| + | else: | ||
| + | velocity.x = 0 | ||
| + | $AnimatedSprite2D.play(" | ||
| + | |||
| + | if Input.is_action_just_pressed(" | ||
| + | velocity.y = JUMP_VELOCITY | ||
| + | |||
| + | velocity.y += GRAVITY | ||
| + | move_and_slide() | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||