Add Player & Movement
parent
ec2a9bb3ff
commit
548e93e861
|
@ -54,6 +54,33 @@ blender=false
|
|||
|
||||
common/drop_mouse_on_gui_input_disabled=true
|
||||
|
||||
[input]
|
||||
|
||||
left={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":65,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":16777231,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
right={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":68,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":16777233,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
up={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":87,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":16777232,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
down={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":83,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":16777234,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[physics]
|
||||
|
||||
common/enable_pause_aware_picking=true
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://src/models/player/sprite.png" type="Texture" id=1]
|
||||
[ext_resource path="res://src/models/player/player.gd" type="Script" id=2]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 7, 11 )
|
||||
|
||||
[node name="Player" type="KinematicBody2D"]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
texture = ExtResource( 1 )
|
||||
centered = false
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2( 12, 12 )
|
||||
shape = SubResource( 1 )
|
|
@ -0,0 +1,12 @@
|
|||
extends KinematicBody2D
|
||||
|
||||
var velocity = Vector2.ZERO
|
||||
var speed = 120
|
||||
|
||||
func get_input():
|
||||
var input_direction = Input.get_vector("left", "right", "up", "down")
|
||||
velocity = input_direction * speed
|
||||
|
||||
func _physics_process(delta):
|
||||
get_input()
|
||||
move_and_slide(velocity)
|
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
|
@ -0,0 +1,35 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/sprite.png-d1a953a55fa409c61c2d0834450a9346.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/models/player/sprite.png"
|
||||
dest_files=[ "res://.import/sprite.png-d1a953a55fa409c61c2d0834450a9346.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=false
|
||||
svg/scale=1.0
|
|
@ -1,8 +1,20 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
[gd_scene load_steps=9 format=2]
|
||||
|
||||
[ext_resource path="res://src/scenes/menu/background/background.png" type="Texture" id=1]
|
||||
[ext_resource path="res://src/scenes/game/sprites/background_houses.png" type="Texture" id=2]
|
||||
[ext_resource path="res://src/scenes/game/spell_holder.gd" type="Script" id=3]
|
||||
[ext_resource path="res://res/fonts/silkscreen/Silkscreen-Regular.ttf" type="DynamicFontData" id=4]
|
||||
[ext_resource path="res://src/models/player/Player.tscn" type="PackedScene" id=5]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=2]
|
||||
extents = Vector2( 10, 60 )
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=3]
|
||||
extents = Vector2( 140, 10.25 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=1]
|
||||
size = 8
|
||||
font_data = ExtResource( 4 )
|
||||
|
||||
[node name="Game" type="Node"]
|
||||
|
||||
|
@ -16,17 +28,46 @@ centered = false
|
|||
region_enabled = true
|
||||
region_rect = Rect2( 0, 0, 320, 180 )
|
||||
|
||||
[node name="Houses" type="Sprite" parent="View/Background"]
|
||||
[node name="Houses" type="StaticBody2D" parent="View/Background"]
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="View/Background/Houses"]
|
||||
texture = ExtResource( 2 )
|
||||
centered = false
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="View/Background/Houses"]
|
||||
position = Vector2( 10, 60 )
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="CollisionShape2D2" type="CollisionShape2D" parent="View/Background/Houses"]
|
||||
position = Vector2( 310, 60 )
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="CollisionShape2D3" type="CollisionShape2D" parent="View/Background/Houses"]
|
||||
position = Vector2( 160, 10.25 )
|
||||
shape = SubResource( 3 )
|
||||
|
||||
[node name="CollisionShape2D4" type="CollisionShape2D" parent="View/Background/Houses"]
|
||||
position = Vector2( 160, 110 )
|
||||
shape = SubResource( 3 )
|
||||
|
||||
[node name="Player" parent="View" instance=ExtResource( 5 )]
|
||||
position = Vector2( 46, 42 )
|
||||
|
||||
[node name="UI" type="Control" parent="."]
|
||||
margin_right = 40.0
|
||||
margin_bottom = 40.0
|
||||
|
||||
[node name="SpellHolder" type="Control" parent="UI"]
|
||||
margin_left = 120.0
|
||||
margin_top = 130.0
|
||||
margin_top = 145.0
|
||||
margin_right = 200.0
|
||||
margin_bottom = 144.0
|
||||
margin_bottom = 159.0
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[node name="Text" type="Label" parent="UI/SpellHolder"]
|
||||
margin_left = 1.0
|
||||
margin_top = -14.0
|
||||
margin_right = 79.0
|
||||
margin_bottom = 7.0
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
text = "spell modifiers"
|
||||
|
|
Loading…
Reference in New Issue