first work
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
extends RigidBody2D
|
||||
|
||||
|
||||
const SPEED = 300.0
|
||||
|
||||
func _ready():
|
||||
contact_monitor = true
|
||||
|
||||
func _physics_process(delta):
|
||||
if Input.is_action_pressed(get_meta("UP_KEY")):
|
||||
move_and_collide(Vector2.UP * SPEED * delta)
|
||||
|
||||
if Input.is_action_pressed(get_meta("DOWN_KEY")):
|
||||
move_and_collide(Vector2.DOWN * SPEED * delta)
|
||||
@@ -0,0 +1,25 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://ce4mnfokb6pkn"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/playground/racket/Racket.gd" id="1_gclos"]
|
||||
|
||||
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_lq6ot"]
|
||||
friction = 0.0
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ehve4"]
|
||||
size = Vector2(40, 144)
|
||||
|
||||
[node name="Racket" type="RigidBody2D"]
|
||||
physics_material_override = SubResource("PhysicsMaterial_lq6ot")
|
||||
gravity_scale = 1.66533e-16
|
||||
can_sleep = false
|
||||
lock_rotation = true
|
||||
script = ExtResource("1_gclos")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(20, 72)
|
||||
shape = SubResource("RectangleShape2D_ehve4")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
offset_right = 40.0
|
||||
offset_bottom = 144.0
|
||||
color = Color(0.0117647, 0.0117647, 0.0117647, 1)
|
||||
Reference in New Issue
Block a user