mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-09 01:10:07 +01:00
This makes demos render correctly on hiDPI displays, while also demonstrating how to handle multiple resolutions. The 3D in 2D demo now uses "3D No-Effects" for the 3D viewport, which is faster to render. Thanks to this, 4× MSAA is now enabled for a better result. The background loading demo now uses mipmaps for better-looking images. The material testers demo now samples mouse input in a resolution-independent manner when panning. Default clear colors were also changed in some projects for visual consistency with the project's theme.
25 lines
559 B
GDScript
25 lines
559 B
GDScript
extends KinematicBody2D
|
|
|
|
# This is a demo showing how KinematicBody2D
|
|
# move_and_slide works.
|
|
|
|
# Member variables
|
|
const MOTION_SPEED = 160 # Pixels/second
|
|
|
|
|
|
func _physics_process(_delta):
|
|
var motion = Vector2()
|
|
|
|
if Input.is_action_pressed("move_up"):
|
|
motion += Vector2(0, -1)
|
|
if Input.is_action_pressed("move_bottom"):
|
|
motion += Vector2(0, 1)
|
|
if Input.is_action_pressed("move_left"):
|
|
motion += Vector2(-1, 0)
|
|
if Input.is_action_pressed("move_right"):
|
|
motion += Vector2(1, 0)
|
|
|
|
motion = motion.normalized() * MOTION_SPEED
|
|
|
|
move_and_slide(motion)
|