Merge branch 'main' of https://github.com/MarcEricMartel/Game-Jam-A23
This commit is contained in:
commit
024ae6d984
@ -1,3 +1,9 @@
|
||||
[gd_scene format=3 uid="uid://uoyiei4wyig3"]
|
||||
[gd_scene load_steps=2 format=3 uid="uid://uoyiei4wyig3"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://b8s2seg2lf7wo" path="res://Scenes/Tilemaps/tileset_1.tscn" id="1_4n82n"]
|
||||
|
||||
[node name="Level1" type="Node2D"]
|
||||
|
||||
[node name="TileSet1" parent="." instance=ExtResource("1_4n82n")]
|
||||
|
||||
[node name="Decor" type="Node2D" parent="."]
|
||||
|
File diff suppressed because one or more lines are too long
@ -380,7 +380,7 @@ script = ExtResource("1_xj62t")
|
||||
sprite_frames = SubResource("SpriteFrames_dqf8u")
|
||||
animation = &"Idle"
|
||||
autoplay = "Idle"
|
||||
frame_progress = 0.93659
|
||||
frame_progress = 0.487368
|
||||
flip_h = true
|
||||
|
||||
[node name="Atk_cooldown" type="Timer" parent="."]
|
||||
@ -406,6 +406,8 @@ scale_amount_min = 0.01
|
||||
scale_amount_max = 0.01
|
||||
color = Color(1, 1, 1, 0.423529)
|
||||
|
||||
[node name="LvlUpSnd" type="AudioStreamPlayer2D" parent="."]
|
||||
|
||||
[node name="CharacterCollision" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CapsuleShape2D_p2hkm")
|
||||
|
||||
|
@ -9,12 +9,14 @@ extends CharacterBody2D
|
||||
@export var level: int = 1
|
||||
@export var hp: int = 100
|
||||
@export var maxhp: int = 100
|
||||
@export var maxvel: float = 2
|
||||
@export var experience: int = 0
|
||||
@export var state: String = "Idle"
|
||||
|
||||
@onready var anim: Node = get_node("Sprite")
|
||||
@onready var cooldown: Node = get_node("Atk_cooldown")
|
||||
@onready var lvlanim: Node = get_node("LvlUp")
|
||||
@onready var lvlsnd: Node = get_node("LvlUpSnd")
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
@ -31,12 +33,25 @@ func _process(delta):
|
||||
is_facing_left = velocity.x >= 0
|
||||
|
||||
# AI STUFF
|
||||
#velocity = processAI(objects,velocity,delta)
|
||||
|
||||
velocity.x += delta
|
||||
velocity.y += delta
|
||||
|
||||
if abs(velocity.x + velocity.y) > maxvel:
|
||||
velocity.x *= maxvel / velocity.x
|
||||
velocity.y *= maxvel / velocity.y
|
||||
|
||||
position += velocity
|
||||
|
||||
|
||||
func processAI(objs, delta):
|
||||
var vec: Vector2 = Vector2(0,0)
|
||||
for obj in objs:
|
||||
vec += obj.vecpos * obj.weight * (1 / (position - obj.vecpos)) * delta
|
||||
return vec.normalized()
|
||||
|
||||
|
||||
func attack():
|
||||
is_attacking = true
|
||||
if (level > 1):
|
||||
@ -86,6 +101,7 @@ func receive_exp(x):
|
||||
func setLevel(lvl):
|
||||
level = lvl
|
||||
lvlanim.restart()
|
||||
lvlsnd.play()
|
||||
|
||||
if level > 2:
|
||||
cooldown.wait_time = 0.5
|
||||
@ -99,3 +115,4 @@ func _on_sprite_animation_looped():
|
||||
if is_attacking:
|
||||
stop_attack()
|
||||
is_dying = false
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user