feat: add game scene and player scene
This commit is contained in:
parent
121f612c27
commit
c921728f4c
0
assets/ignore.me.txt
Normal file
0
assets/ignore.me.txt
Normal file
8
game.tscn
Normal file
8
game.tscn
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
[gd_scene load_steps=2 format=3 uid="uid://c0s77m0ea3sey"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dy71gkll44btc" path="res://scenes/player.tscn" id="1_geqht"]
|
||||||
|
|
||||||
|
[node name="Game" type="Node2D"]
|
||||||
|
|
||||||
|
[node name="Player" parent="." instance=ExtResource("1_geqht")]
|
||||||
|
position = Vector2(567, 297)
|
||||||
@ -11,5 +11,6 @@ config_version=5
|
|||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="BoatCoop"
|
config/name="BoatCoop"
|
||||||
|
run/main_scene="res://game.tscn"
|
||||||
config/features=PackedStringArray("4.3", "Forward Plus")
|
config/features=PackedStringArray("4.3", "Forward Plus")
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|||||||
23
scenes/player.tscn
Normal file
23
scenes/player.tscn
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
[gd_scene load_steps=5 format=3 uid="uid://dy71gkll44btc"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scripts/player.gd" id="1_jlots"]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_scfaw"]
|
||||||
|
size = Vector2(80, 124)
|
||||||
|
|
||||||
|
[sub_resource type="Gradient" id="Gradient_pnm6c"]
|
||||||
|
colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 1)
|
||||||
|
|
||||||
|
[sub_resource type="GradientTexture1D" id="GradientTexture1D_wyt1d"]
|
||||||
|
gradient = SubResource("Gradient_pnm6c")
|
||||||
|
|
||||||
|
[node name="Player" type="CharacterBody2D"]
|
||||||
|
motion_mode = 1
|
||||||
|
script = ExtResource("1_jlots")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("RectangleShape2D_scfaw")
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
|
scale = Vector2(0.3125, 126)
|
||||||
|
texture = SubResource("GradientTexture1D_wyt1d")
|
||||||
10
scripts/player.gd
Normal file
10
scripts/player.gd
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
extends CharacterBody2D
|
||||||
|
|
||||||
|
const SPEED = 300.0
|
||||||
|
const JUMP_VELOCITY = -400.0
|
||||||
|
|
||||||
|
func _physics_process(delta):
|
||||||
|
velocity.x = Input.get_axis("ui_left", "ui_right") * SPEED
|
||||||
|
velocity.y = Input.get_axis("ui_up", "ui_down") * SPEED
|
||||||
|
|
||||||
|
move_and_slide()
|
||||||
Loading…
Reference in New Issue
Block a user