character modell change + character movement changes
This commit is contained in:
parent
96f67e78e9
commit
096a6126c1
5 changed files with 48 additions and 8 deletions
|
@ -13,6 +13,7 @@ size = Vector2(1928.3, 529.623)
|
||||||
[node name="Player" parent="." instance=ExtResource("1_nvifn")]
|
[node name="Player" parent="." instance=ExtResource("1_nvifn")]
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
|
visible = false
|
||||||
z_index = -1
|
z_index = -1
|
||||||
texture = ExtResource("2_qherw")
|
texture = ExtResource("2_qherw")
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,22 @@
|
||||||
[gd_scene load_steps=4 format=3 uid="uid://snxpqx0ony7s"]
|
[gd_scene load_steps=4 format=3 uid="uid://snxpqx0ony7s"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scripts/player_movement.gd" id="1_otvu6"]
|
[ext_resource type="Script" path="res://scripts/player_movement.gd" id="1_otvu6"]
|
||||||
[ext_resource type="Texture2D" uid="uid://b6gxkpy33b88g" path="res://temp_assets/player.png" id="2_d4ig1"]
|
[ext_resource type="Texture2D" uid="uid://qcx482jc7pqr" path="res://textures/Virus_Player.png" id="2_b0xe3"]
|
||||||
|
|
||||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_jqi2f"]
|
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_jqi2f"]
|
||||||
radius = 16.0
|
radius = 9.0
|
||||||
height = 32.0
|
height = 22.0
|
||||||
|
|
||||||
[node name="Player" type="Node2D"]
|
[node name="Player" type="Node2D"]
|
||||||
|
|
||||||
[node name="CharacterBody2D" type="CharacterBody2D" parent="."]
|
[node name="CharacterBody2D" type="CharacterBody2D" parent="."]
|
||||||
script = ExtResource("1_otvu6")
|
script = ExtResource("1_otvu6")
|
||||||
|
speed = 250
|
||||||
|
jump_count = 1
|
||||||
|
jump_strength = 600
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="CharacterBody2D"]
|
[node name="Sprite2D" type="Sprite2D" parent="CharacterBody2D"]
|
||||||
texture = ExtResource("2_d4ig1")
|
texture = ExtResource("2_b0xe3")
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBody2D"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBody2D"]
|
||||||
shape = SubResource("CapsuleShape2D_jqi2f")
|
shape = SubResource("CapsuleShape2D_jqi2f")
|
||||||
|
|
|
@ -3,7 +3,7 @@ extends CharacterBody2D
|
||||||
@export var speed = 340;
|
@export var speed = 340;
|
||||||
@export var gravity = 50;
|
@export var gravity = 50;
|
||||||
@export var jump_count = 2;
|
@export var jump_count = 2;
|
||||||
@export var jump_strength = 700;
|
@export var jump_strength = 100
|
||||||
|
|
||||||
var jump_count_current = 2;
|
var jump_count_current = 2;
|
||||||
var input_direction = 0 #To keep track of which direction we where moving in last frame
|
var input_direction = 0 #To keep track of which direction we where moving in last frame
|
||||||
|
@ -24,14 +24,16 @@ func get_input():
|
||||||
|
|
||||||
velocity.x = input_direction * speed
|
velocity.x = input_direction * speed
|
||||||
|
|
||||||
|
if is_on_floor():
|
||||||
|
jump_count_current = jump_count
|
||||||
|
|
||||||
if Input.is_action_just_pressed("player_jump") and jump_count_current > 0:
|
if Input.is_action_just_pressed("player_jump") and jump_count_current > 0:
|
||||||
velocity.y = -1 * jump_strength
|
velocity.y = -1 * jump_strength
|
||||||
jump_count_current = jump_count_current-1
|
jump_count_current = jump_count_current-1
|
||||||
elif Input.is_action_pressed("player_jump"): #Fall less fast if we keep holding the button
|
elif Input.is_action_pressed("player_jump"): #Fall less fast if we keep holding the button
|
||||||
velocity.y += -1 * 20
|
velocity.y += -1 * 25
|
||||||
|
|
||||||
|
|
||||||
if is_on_floor():
|
|
||||||
jump_count_current = jump_count
|
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
get_input()
|
get_input()
|
||||||
|
|
Before Width: | Height: | Size: 580 B After Width: | Height: | Size: 580 B |
34
gmtk_2024/textures/Virus_Player.png.import
Normal file
34
gmtk_2024/textures/Virus_Player.png.import
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://qcx482jc7pqr"
|
||||||
|
path="res://.godot/imported/Virus_Player.png-4c00daa1e7b5018c0db649deca9e637e.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://textures/Virus_Player.png"
|
||||||
|
dest_files=["res://.godot/imported/Virus_Player.png-4c00daa1e7b5018c0db649deca9e637e.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
Loading…
Add table
Reference in a new issue