Compare commits
No commits in common. "0b9b1e75d48d11b198e0bcf22c0537cc6c4b208b" and "03117b77fbd05995200b055d96c433f6dca6ff54" have entirely different histories.
0b9b1e75d4
...
03117b77fb
Binary file not shown.
|
Before Width: | Height: | Size: 887 KiB |
|
|
@ -1,40 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://boknmstvkc0a2"
|
||||
path="res://.godot/imported/player-sprite-placeholder-attacking-crop.png-7a6a3f2b68f208c74f7cac8cb16cfc5e.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://molecular/assets/player-sprite-placeholder-attacking-crop.png"
|
||||
dest_files=["res://.godot/imported/player-sprite-placeholder-attacking-crop.png-7a6a3f2b68f208c74f7cac8cb16cfc5e.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
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/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
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
|
||||
|
|
@ -1,12 +1,11 @@
|
|||
extends CharacterBody2D
|
||||
|
||||
@export var attack_duration = 0.2 # TODO: finetune
|
||||
@export var attack_duration = 0.12 # TODO: finetune
|
||||
@export var attack_cooldown_duration = 0.4
|
||||
|
||||
@onready var attack_area: Area2D = $AttackArea
|
||||
@onready var attack_timer: Timer = $AttackTimer
|
||||
@onready var attack_cooldown_timer: Timer = $AttackCooldownTimer
|
||||
@onready var sprite: AnimatedSprite2D = $AnimatedSprite2D
|
||||
|
||||
@export var speed = 200
|
||||
var damage = 10
|
||||
|
|
@ -20,8 +19,6 @@ func _ready() -> void:
|
|||
attack_timer.wait_time = attack_duration
|
||||
attack_cooldown_timer.wait_time = attack_cooldown_duration
|
||||
|
||||
|
||||
|
||||
func _process(delta):
|
||||
velocity = Vector2.ZERO
|
||||
if Input.is_action_pressed("move_right"):
|
||||
|
|
@ -35,9 +32,6 @@ func _process(delta):
|
|||
if Input.is_action_pressed("try_attack"):
|
||||
try_attack()
|
||||
|
||||
if not velocity.is_zero_approx():
|
||||
look_at(velocity * 1000000) # FIXME: ideally we look_at a point at infinity
|
||||
# or rotate the player some other way
|
||||
move_and_collide(speed * velocity * delta)
|
||||
#position += speed * velocity * delta
|
||||
position = GameManager.get_boundaried_position(position)
|
||||
|
|
@ -51,25 +45,19 @@ func attack() -> void:
|
|||
can_attack = false
|
||||
attack_area.monitoring = true
|
||||
attack_timer.start()
|
||||
sprite.play("attacking")
|
||||
# TODO: attack animation+sound+etc
|
||||
|
||||
func _on_attack_timeout() -> void:
|
||||
attack_area.monitoring = false
|
||||
sprite.play("default")
|
||||
attack_cooldown_timer.start()
|
||||
|
||||
func _on_cooldown_timeout() -> void:
|
||||
can_attack = true
|
||||
|
||||
func _on_attack_hit(body: Node2D) -> void:
|
||||
var hit_hittable = false
|
||||
if body.is_in_group("prey") or body.is_in_group("predators"):
|
||||
if body.has_method("handle_damage"):
|
||||
body.handle_damage(damage)
|
||||
hit_hittable = true
|
||||
elif body.is_in_group("resources"):
|
||||
pass
|
||||
if hit_hittable:
|
||||
await get_tree().create_timer(0.2).timeout
|
||||
sprite.play("default")
|
||||
# TODO: resource handling logic
|
||||
|
|
|
|||
|
|
@ -1,21 +1,12 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://dxluckxdkpv4f"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://dxluckxdkpv4f"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://di7eglnrnqm6i" path="res://molecular/molecular_player.gd" id="1_0ix7k"]
|
||||
[ext_resource type="Texture2D" uid="uid://boknmstvkc0a2" path="res://molecular/assets/player-sprite-placeholder-attacking-crop.png" id="2_5hxmy"]
|
||||
[ext_resource type="Texture2D" uid="uid://cxwvga07sm3yl" path="res://molecular/assets/player-sprite-placeholder-crop.png" id="2_en8op"]
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_onrkg"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("2_5hxmy")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"attacking",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 5.0,
|
||||
"texture": ExtResource("2_en8op")
|
||||
}],
|
||||
"loop": true,
|
||||
|
|
@ -23,8 +14,8 @@ animations = [{
|
|||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_5hxmy"]
|
||||
radius = 378.18
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_en8op"]
|
||||
size = Vector2(765.4969, 706.5864)
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_4flbx"]
|
||||
radius = 191.95984
|
||||
|
|
@ -45,11 +36,12 @@ rotation = -1.5732701
|
|||
collision_mask = 2
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="AttackArea"]
|
||||
position = Vector2(41.029465, 288.86832)
|
||||
shape = SubResource("CircleShape2D_5hxmy")
|
||||
position = Vector2(29.579561, 730.73236)
|
||||
shape = SubResource("RectangleShape2D_en8op")
|
||||
debug_color = Color(0.80813414, 0.3957308, 0.3356335, 0.41960785)
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." groups=["player"]]
|
||||
position = Vector2(0, 56)
|
||||
rotation = -1.5732701
|
||||
shape = SubResource("CapsuleShape2D_4flbx")
|
||||
|
||||
|
|
|
|||
|
|
@ -50,10 +50,11 @@ func die() -> void:
|
|||
super.die()
|
||||
|
||||
func become_injured() -> void:
|
||||
sprite.play("Injured")
|
||||
mirrorSprite1.play("Injured")
|
||||
mirrorSprite2.play("Injured")
|
||||
mirrorSprite3.play("Injured")
|
||||
sprite.animation = "Injured"
|
||||
mirrorSprite1.animation = "Injured"
|
||||
mirrorSprite2.animation = "Injured"
|
||||
mirrorSprite3.animation = "Injured"
|
||||
sprite.play()
|
||||
|
||||
# Mirroring table:
|
||||
# |---|---|---|---|
|
||||
|
|
|
|||
|
|
@ -55,3 +55,4 @@ maxHealth = 20
|
|||
scale = Vector2(0.1, 0.1)
|
||||
sprite_frames = SubResource("SpriteFrames_66x8p")
|
||||
animation = &"Dying"
|
||||
frame_progress = 0.60472965
|
||||
|
|
|
|||
Loading…
Reference in New Issue