Second Prototype; Added Player Animations
This commit is contained in:
parent
51774f485b
commit
e82438139f
13 changed files with 332 additions and 73 deletions
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 455 B After Width: | Height: | Size: 1.5 KiB |
|
|
@ -1,4 +1,14 @@
|
||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
|
enum GAMETIME {
|
||||||
|
MIN = 240,
|
||||||
|
MAX = 360
|
||||||
|
}
|
||||||
|
|
||||||
|
var money = 0
|
||||||
|
|
||||||
func resetValues():
|
func resetValues():
|
||||||
pass
|
money = 0
|
||||||
|
|
||||||
|
func addMoney(n):
|
||||||
|
money += n
|
||||||
|
|
|
||||||
14
scenes/game/collectionArea/collectionArea.tscn
Normal file
14
scenes/game/collectionArea/collectionArea.tscn
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
[gd_scene load_steps=3 format=3 uid="uid://sgnp11xty7i1"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scenes/game/collectionArea/collection_area.gd" id="1_c4amf"]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_1qvdj"]
|
||||||
|
size = Vector2(96, 96)
|
||||||
|
|
||||||
|
[node name="CollectionArea" type="Area2D"]
|
||||||
|
collision_layer = 8
|
||||||
|
collision_mask = 4
|
||||||
|
script = ExtResource("1_c4amf")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("RectangleShape2D_1qvdj")
|
||||||
10
scenes/game/collectionArea/collection_area.gd
Normal file
10
scenes/game/collectionArea/collection_area.gd
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
extends Area2D
|
||||||
|
|
||||||
|
func _physics_process(delta: float) -> void:
|
||||||
|
cashInObject()
|
||||||
|
|
||||||
|
func cashInObject():
|
||||||
|
for i in get_overlapping_areas():
|
||||||
|
if not i.isCarryied():
|
||||||
|
G.addMoney(i.getValue())
|
||||||
|
i.queue_free()
|
||||||
|
|
@ -7,6 +7,11 @@ extends "res://scenes/game/entities/entity.gd"
|
||||||
|
|
||||||
@onready var pickupArea = $PickupArea
|
@onready var pickupArea = $PickupArea
|
||||||
|
|
||||||
|
@onready var healthBar = $Camera2D/CanvasLayer/Control/VBoxContainer/HealthBar
|
||||||
|
@onready var rollCooldownBar = $Camera2D/CanvasLayer/Control/VBoxContainer/RollCooldownBar
|
||||||
|
@onready var moneyValueLabel = $Camera2D/CanvasLayer/Control/HBoxContainer/MoneyValue
|
||||||
|
|
||||||
|
|
||||||
var rollSpeed = maxSpeed * 5
|
var rollSpeed = maxSpeed * 5
|
||||||
|
|
||||||
const rollCooldown = 5.0
|
const rollCooldown = 5.0
|
||||||
|
|
@ -22,7 +27,17 @@ var object = null
|
||||||
var lastDirection : Vector2
|
var lastDirection : Vector2
|
||||||
var lastdirectionVector : Vector2
|
var lastdirectionVector : Vector2
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
rollCooldownBar.min_value = 0
|
||||||
|
rollCooldownBar.max_value = rollCooldown
|
||||||
|
healthBar.min_value = 0
|
||||||
|
healthBar.max_value = health
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
|
rollCooldownBar.value = rollCooldownTimer.time_left
|
||||||
|
healthBar.value = health
|
||||||
|
moneyValueLabel.text = str(G.money)
|
||||||
|
|
||||||
var direction : Vector2 = Input.get_vector("MOVE_LEFT", "MOVE_RIGHT", "MOVE_UP", "MOVE_DOWN").normalized()
|
var direction : Vector2 = Input.get_vector("MOVE_LEFT", "MOVE_RIGHT", "MOVE_UP", "MOVE_DOWN").normalized()
|
||||||
#var direction : Vector2 = Vector2(
|
#var direction : Vector2 = Vector2(
|
||||||
|
|
@ -39,8 +54,9 @@ func _physics_process(delta: float) -> void:
|
||||||
if Input.is_action_just_pressed("INTERACT"):
|
if Input.is_action_just_pressed("INTERACT"):
|
||||||
match carrying:
|
match carrying:
|
||||||
false:
|
false:
|
||||||
if pickupArea.get_overlapping_areas() != []:
|
|
||||||
pickup(pickupArea.get_overlapping_areas()[0])
|
|
||||||
|
pickup(getNearestObject(pickupArea.get_overlapping_areas()))
|
||||||
true:
|
true:
|
||||||
dropObject()
|
dropObject()
|
||||||
#pickupArea.get_overlapping_areas()[0].pickup(self)
|
#pickupArea.get_overlapping_areas()[0].pickup(self)
|
||||||
|
|
@ -74,33 +90,40 @@ func roll():
|
||||||
func setAnimation():
|
func setAnimation():
|
||||||
if not rolling:
|
if not rolling:
|
||||||
if Input.is_action_pressed("MOVE_LEFT") and not Input.is_action_pressed("MOVE_RIGHT") and animatedSprite.animation != "LEFT":
|
if Input.is_action_pressed("MOVE_LEFT") and not Input.is_action_pressed("MOVE_RIGHT") and animatedSprite.animation != "LEFT":
|
||||||
animatedSprite.play("LEFT")
|
animatedSprite.play("SIDE")
|
||||||
|
animatedSprite.flip_h = true
|
||||||
elif Input.is_action_pressed("MOVE_RIGHT") and not Input.is_action_pressed("MOVE_LEFT") and animatedSprite.animation != "RIGHT":
|
elif Input.is_action_pressed("MOVE_RIGHT") and not Input.is_action_pressed("MOVE_LEFT") and animatedSprite.animation != "RIGHT":
|
||||||
animatedSprite.play("RIGHT")
|
animatedSprite.play("SIDE")
|
||||||
elif Input.is_action_pressed("MOVE_UP") and animatedSprite.animation != "UP" and not Input.is_action_pressed("MOVE_LEFT") and not Input.is_action_pressed("MOVE_RIGHT"):
|
animatedSprite.flip_h = false
|
||||||
|
elif Input.is_action_pressed("MOVE_UP") and not Input.is_action_pressed("MOVE_DOWN") and animatedSprite.animation != "UP" and not Input.is_action_pressed("MOVE_LEFT") and not Input.is_action_pressed("MOVE_RIGHT"):
|
||||||
animatedSprite.play("UP")
|
animatedSprite.play("UP")
|
||||||
elif Input.is_action_pressed("MOVE_DOWN") and animatedSprite.animation != "DOWN" and not Input.is_action_pressed("MOVE_LEFT") and not Input.is_action_pressed("MOVE_RIGHT"):
|
elif Input.is_action_pressed("MOVE_DOWN") and not Input.is_action_pressed("MOVE_UP") and animatedSprite.animation != "DOWN" and not Input.is_action_pressed("MOVE_LEFT") and not Input.is_action_pressed("MOVE_RIGHT"):
|
||||||
animatedSprite.play("DOWN")
|
animatedSprite.play("DOWN")
|
||||||
elif not (Input.is_action_pressed("MOVE_UP") or Input.is_action_pressed("MOVE_RIGHT") or Input.is_action_pressed("MOVE_DOWN") or Input.is_action_pressed("MOVE_LEFT")):
|
elif not animatedSprite.animation == "Ball" and not (Input.is_action_pressed("MOVE_UP") or Input.is_action_pressed("MOVE_RIGHT") or Input.is_action_pressed("MOVE_DOWN") or Input.is_action_pressed("MOVE_LEFT")):
|
||||||
animatedSprite.play("IDLE")
|
animatedSprite.play("IDLE")
|
||||||
|
animatedSprite.flip_h = false
|
||||||
|
elif animatedSprite.animation != "Ball":
|
||||||
|
animatedSprite.play("Ball")
|
||||||
|
|
||||||
func _on_roll_timeout() -> void:
|
func _on_roll_timeout() -> void:
|
||||||
|
animatedSprite.play_backwards("Ball")
|
||||||
resetSpeed()
|
resetSpeed()
|
||||||
invincible = false
|
invincible = false
|
||||||
rolling = false
|
rolling = false
|
||||||
rollCooldownTimer.start(rollCooldown)
|
rollCooldownTimer.start(rollCooldown)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func _on_roll_cooldown_timer_timeout() -> void:
|
func _on_roll_cooldown_timer_timeout() -> void:
|
||||||
canRoll = true
|
canRoll = true
|
||||||
|
|
||||||
func pickup(newObject):
|
func pickup(newObject):
|
||||||
if newObject.player == null and not rolling:
|
if newObject != null:
|
||||||
carrying = true
|
if newObject.player == null and not rolling:
|
||||||
object = newObject
|
carrying = true
|
||||||
speed -= object.getWeight()
|
object = newObject
|
||||||
object.pickup(self)
|
speed -= object.getWeight()
|
||||||
|
object.pickup(self)
|
||||||
|
|
||||||
func dropObject():
|
func dropObject():
|
||||||
if carrying:
|
if carrying:
|
||||||
|
|
@ -108,3 +131,16 @@ func dropObject():
|
||||||
object.drop()
|
object.drop()
|
||||||
object = null
|
object = null
|
||||||
resetSpeed()
|
resetSpeed()
|
||||||
|
|
||||||
|
func getNearestObject(list):
|
||||||
|
var nearestObject = null
|
||||||
|
var shortestDistance = 0
|
||||||
|
if list != []:
|
||||||
|
for i in list:
|
||||||
|
if nearestObject == null:
|
||||||
|
shortestDistance = global_position.distance_to(i.global_position)
|
||||||
|
nearestObject = i
|
||||||
|
elif shortestDistance > global_position.distance_to(i.global_position):
|
||||||
|
shortestDistance = global_position.distance_to(i.global_position)
|
||||||
|
nearestObject = i
|
||||||
|
return nearestObject
|
||||||
|
|
|
||||||
|
|
@ -1,101 +1,220 @@
|
||||||
[gd_resource type="SpriteFrames" load_steps=12 format=3 uid="uid://dv18sf3aj0n1h"]
|
[gd_resource type="SpriteFrames" load_steps=29 format=3 uid="uid://dv18sf3aj0n1h"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://b2xbgtcyxvi73" path="res://Assets/Player/Player.png" id="1_21ptg"]
|
[ext_resource type="Texture2D" uid="uid://b2xbgtcyxvi73" path="res://Assets/Player/Player.png" id="1_21ptg"]
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_m3bgq"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_y1avd"]
|
||||||
atlas = ExtResource("1_21ptg")
|
atlas = ExtResource("1_21ptg")
|
||||||
region = Rect2(0, 64, 16, 32)
|
region = Rect2(320, 0, 16, 16)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_6rhbk"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_0vp22"]
|
||||||
atlas = ExtResource("1_21ptg")
|
atlas = ExtResource("1_21ptg")
|
||||||
region = Rect2(16, 64, 16, 32)
|
region = Rect2(336, 0, 16, 16)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_51ijx"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_k732d"]
|
||||||
atlas = ExtResource("1_21ptg")
|
atlas = ExtResource("1_21ptg")
|
||||||
region = Rect2(0, 0, 16, 32)
|
region = Rect2(352, 0, 16, 16)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ydp1x"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_66jg3"]
|
||||||
atlas = ExtResource("1_21ptg")
|
atlas = ExtResource("1_21ptg")
|
||||||
region = Rect2(16, 0, 16, 32)
|
region = Rect2(368, 0, 16, 16)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_l7ggo"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_tyq7v"]
|
||||||
atlas = ExtResource("1_21ptg")
|
atlas = ExtResource("1_21ptg")
|
||||||
region = Rect2(0, 128, 16, 32)
|
region = Rect2(384, 0, 16, 16)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_404j7"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_tv5ix"]
|
||||||
atlas = ExtResource("1_21ptg")
|
atlas = ExtResource("1_21ptg")
|
||||||
region = Rect2(16, 128, 16, 32)
|
region = Rect2(256, 0, 16, 16)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_csdks"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_6qsai"]
|
||||||
atlas = ExtResource("1_21ptg")
|
atlas = ExtResource("1_21ptg")
|
||||||
region = Rect2(0, 96, 16, 32)
|
region = Rect2(272, 0, 16, 16)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_yahsm"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_o7io3"]
|
||||||
atlas = ExtResource("1_21ptg")
|
atlas = ExtResource("1_21ptg")
|
||||||
region = Rect2(16, 96, 16, 32)
|
region = Rect2(288, 0, 16, 16)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_8pkt3"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_1y4qq"]
|
||||||
atlas = ExtResource("1_21ptg")
|
atlas = ExtResource("1_21ptg")
|
||||||
region = Rect2(0, 32, 16, 32)
|
region = Rect2(304, 0, 16, 16)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_rq2en"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_4kyvo"]
|
||||||
atlas = ExtResource("1_21ptg")
|
atlas = ExtResource("1_21ptg")
|
||||||
region = Rect2(16, 32, 16, 32)
|
region = Rect2(0, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_3pdg8"]
|
||||||
|
atlas = ExtResource("1_21ptg")
|
||||||
|
region = Rect2(16, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_6oejk"]
|
||||||
|
atlas = ExtResource("1_21ptg")
|
||||||
|
region = Rect2(32, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_jcl2a"]
|
||||||
|
atlas = ExtResource("1_21ptg")
|
||||||
|
region = Rect2(48, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_f0bb7"]
|
||||||
|
atlas = ExtResource("1_21ptg")
|
||||||
|
region = Rect2(32, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_642vk"]
|
||||||
|
atlas = ExtResource("1_21ptg")
|
||||||
|
region = Rect2(16, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_mugnp"]
|
||||||
|
atlas = ExtResource("1_21ptg")
|
||||||
|
region = Rect2(0, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ptakl"]
|
||||||
|
atlas = ExtResource("1_21ptg")
|
||||||
|
region = Rect2(80, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_uxbgn"]
|
||||||
|
atlas = ExtResource("1_21ptg")
|
||||||
|
region = Rect2(96, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_e214p"]
|
||||||
|
atlas = ExtResource("1_21ptg")
|
||||||
|
region = Rect2(112, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_brspq"]
|
||||||
|
atlas = ExtResource("1_21ptg")
|
||||||
|
region = Rect2(128, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_fd4ha"]
|
||||||
|
atlas = ExtResource("1_21ptg")
|
||||||
|
region = Rect2(144, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_m4hph"]
|
||||||
|
atlas = ExtResource("1_21ptg")
|
||||||
|
region = Rect2(160, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_3gt14"]
|
||||||
|
atlas = ExtResource("1_21ptg")
|
||||||
|
region = Rect2(176, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_acjdb"]
|
||||||
|
atlas = ExtResource("1_21ptg")
|
||||||
|
region = Rect2(192, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ewdt3"]
|
||||||
|
atlas = ExtResource("1_21ptg")
|
||||||
|
region = Rect2(208, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_rlv0r"]
|
||||||
|
atlas = ExtResource("1_21ptg")
|
||||||
|
region = Rect2(224, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ij60e"]
|
||||||
|
atlas = ExtResource("1_21ptg")
|
||||||
|
region = Rect2(240, 0, 16, 16)
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
animations = [{
|
animations = [{
|
||||||
"frames": [{
|
"frames": [{
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
"texture": SubResource("AtlasTexture_m3bgq")
|
"texture": SubResource("AtlasTexture_y1avd")
|
||||||
}, {
|
}, {
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
"texture": SubResource("AtlasTexture_6rhbk")
|
"texture": SubResource("AtlasTexture_0vp22")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_k732d")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_66jg3")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_tyq7v")
|
||||||
|
}],
|
||||||
|
"loop": false,
|
||||||
|
"name": &"Ball",
|
||||||
|
"speed": 15.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_tv5ix")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_6qsai")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_o7io3")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_1y4qq")
|
||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": &"DOWN",
|
"name": &"DOWN",
|
||||||
"speed": 5.0
|
"speed": 10.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [{
|
"frames": [{
|
||||||
"duration": 1.0,
|
"duration": 20.0,
|
||||||
"texture": SubResource("AtlasTexture_51ijx")
|
"texture": SubResource("AtlasTexture_4kyvo")
|
||||||
}, {
|
}, {
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
"texture": SubResource("AtlasTexture_ydp1x")
|
"texture": SubResource("AtlasTexture_3pdg8")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_6oejk")
|
||||||
|
}, {
|
||||||
|
"duration": 3.0,
|
||||||
|
"texture": SubResource("AtlasTexture_jcl2a")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_f0bb7")
|
||||||
|
}, {
|
||||||
|
"duration": 10.0,
|
||||||
|
"texture": SubResource("AtlasTexture_642vk")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_mugnp")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_ptakl")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_uxbgn")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_e214p")
|
||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": &"IDLE",
|
"name": &"IDLE",
|
||||||
"speed": 5.0
|
"speed": 10.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [{
|
"frames": [{
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
"texture": SubResource("AtlasTexture_l7ggo")
|
"texture": SubResource("AtlasTexture_brspq")
|
||||||
}, {
|
}, {
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
"texture": SubResource("AtlasTexture_404j7")
|
"texture": SubResource("AtlasTexture_fd4ha")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_m4hph")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_3gt14")
|
||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": &"LEFT",
|
"name": &"SIDE",
|
||||||
"speed": 5.0
|
"speed": 10.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [{
|
"frames": [{
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
"texture": SubResource("AtlasTexture_csdks")
|
"texture": SubResource("AtlasTexture_acjdb")
|
||||||
}, {
|
}, {
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
"texture": SubResource("AtlasTexture_yahsm")
|
"texture": SubResource("AtlasTexture_ewdt3")
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"RIGHT",
|
|
||||||
"speed": 5.0
|
|
||||||
}, {
|
|
||||||
"frames": [{
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_8pkt3")
|
|
||||||
}, {
|
}, {
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
"texture": SubResource("AtlasTexture_rq2en")
|
"texture": SubResource("AtlasTexture_rlv0r")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_ij60e")
|
||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": &"UP",
|
"name": &"UP",
|
||||||
"speed": 5.0
|
"speed": 10.0
|
||||||
}]
|
}]
|
||||||
|
|
|
||||||
|
|
@ -4,23 +4,27 @@
|
||||||
[ext_resource type="Script" path="res://scenes/game/entities/player/player.gd" id="2_s0pfn"]
|
[ext_resource type="Script" path="res://scenes/game/entities/player/player.gd" id="2_s0pfn"]
|
||||||
[ext_resource type="SpriteFrames" uid="uid://dv18sf3aj0n1h" path="res://scenes/game/entities/player/player.tres" id="3_mlsai"]
|
[ext_resource type="SpriteFrames" uid="uid://dv18sf3aj0n1h" path="res://scenes/game/entities/player/player.tres" id="3_mlsai"]
|
||||||
|
|
||||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_upmug"]
|
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_ihc0q"]
|
||||||
radius = 8.0
|
radius = 4.0
|
||||||
height = 16.0
|
height = 16.0
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_8u3aq"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_8u3aq"]
|
||||||
radius = 8.0
|
radius = 8.94427
|
||||||
|
|
||||||
[node name="Player" groups=["Player"] instance=ExtResource("1_kmfws")]
|
[node name="Player" groups=["Player"] instance=ExtResource("1_kmfws")]
|
||||||
script = ExtResource("2_s0pfn")
|
script = ExtResource("2_s0pfn")
|
||||||
|
|
||||||
[node name="CollisionShape2D" parent="." index="0"]
|
[node name="CollisionShape2D" parent="." index="0"]
|
||||||
position = Vector2(0, 8)
|
position = Vector2(0, 8)
|
||||||
shape = SubResource("CapsuleShape2D_upmug")
|
rotation = 1.57079
|
||||||
|
shape = SubResource("CapsuleShape2D_ihc0q")
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" parent="." index="1"]
|
[node name="AnimatedSprite2D" parent="." index="1"]
|
||||||
|
visibility_layer = 4
|
||||||
|
scale = Vector2(1.5, 1.5)
|
||||||
sprite_frames = ExtResource("3_mlsai")
|
sprite_frames = ExtResource("3_mlsai")
|
||||||
animation = &"DOWN"
|
animation = &"IDLE"
|
||||||
|
frame_progress = 0.904526
|
||||||
metadata/_aseprite_wizard_config_ = {
|
metadata/_aseprite_wizard_config_ = {
|
||||||
"layer": "",
|
"layer": "",
|
||||||
"o_ex_p": "",
|
"o_ex_p": "",
|
||||||
|
|
@ -36,10 +40,56 @@ metadata/_aseprite_wizard_interface_config_ = {
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="Camera2D" type="Camera2D" parent="." index="2"]
|
[node name="Camera2D" type="Camera2D" parent="." index="2"]
|
||||||
zoom = Vector2(3, 3)
|
zoom = Vector2(4, 4)
|
||||||
limit_smoothed = true
|
limit_smoothed = true
|
||||||
position_smoothing_enabled = true
|
position_smoothing_enabled = true
|
||||||
|
|
||||||
|
[node name="CanvasLayer" type="CanvasLayer" parent="Camera2D" index="0"]
|
||||||
|
|
||||||
|
[node name="Control" type="Control" parent="Camera2D/CanvasLayer" index="0"]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="Camera2D/CanvasLayer/Control" index="0"]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_right = 40.0
|
||||||
|
offset_bottom = 40.0
|
||||||
|
|
||||||
|
[node name="MoneyLabel" type="Label" parent="Camera2D/CanvasLayer/Control/HBoxContainer" index="0"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "MONEY"
|
||||||
|
|
||||||
|
[node name="MoneyValue" type="Label" parent="Camera2D/CanvasLayer/Control/HBoxContainer" index="1"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="Camera2D/CanvasLayer/Control" index="1"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 2
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_left = 16.0
|
||||||
|
offset_top = -63.9999
|
||||||
|
offset_right = 312.0
|
||||||
|
offset_bottom = -29.0
|
||||||
|
grow_vertical = 0
|
||||||
|
scale = Vector2(1.5, 1.5)
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="RollCooldownBar" type="ProgressBar" parent="Camera2D/CanvasLayer/Control/VBoxContainer" index="0"]
|
||||||
|
layout_mode = 2
|
||||||
|
show_percentage = false
|
||||||
|
|
||||||
|
[node name="HealthBar" type="ProgressBar" parent="Camera2D/CanvasLayer/Control/VBoxContainer" index="1"]
|
||||||
|
layout_mode = 2
|
||||||
|
rounded = true
|
||||||
|
|
||||||
[node name="RollTimer" type="Timer" parent="." index="3"]
|
[node name="RollTimer" type="Timer" parent="." index="3"]
|
||||||
one_shot = true
|
one_shot = true
|
||||||
|
|
||||||
|
|
@ -47,11 +97,11 @@ one_shot = true
|
||||||
one_shot = true
|
one_shot = true
|
||||||
|
|
||||||
[node name="PickupArea" type="Area2D" parent="." index="5" groups=["Player"]]
|
[node name="PickupArea" type="Area2D" parent="." index="5" groups=["Player"]]
|
||||||
position = Vector2(0, 8)
|
|
||||||
collision_layer = 8
|
collision_layer = 8
|
||||||
collision_mask = 4
|
collision_mask = 4
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="PickupArea" index="0"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="PickupArea" index="0"]
|
||||||
|
position = Vector2(0, 4)
|
||||||
shape = SubResource("CircleShape2D_8u3aq")
|
shape = SubResource("CircleShape2D_8u3aq")
|
||||||
|
|
||||||
[connection signal="timeout" from="RollTimer" to="." method="_on_roll_timeout"]
|
[connection signal="timeout" from="RollTimer" to="." method="_on_roll_timeout"]
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,15 @@
|
||||||
extends Node2D
|
extends Node2D
|
||||||
|
|
||||||
|
@onready var stormTimer = $StormTimer
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
pass # Replace with function body.
|
stormTimer.start(randi_range(G.GAMETIME.MIN, G.GAMETIME.MAX))
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
func _on_storm_timer_timeout() -> void:
|
||||||
|
print("Storm")
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
[gd_scene load_steps=5 format=3 uid="uid://dgxw2n4ei2ahe"]
|
[gd_scene load_steps=6 format=3 uid="uid://dgxw2n4ei2ahe"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scenes/game/mainGame/main_game.gd" id="1_napbe"]
|
[ext_resource type="Script" path="res://scenes/game/mainGame/main_game.gd" id="1_napbe"]
|
||||||
[ext_resource type="PackedScene" uid="uid://0duodsosmfpq" path="res://scenes/game/entities/player/player.tscn" id="3_sjgkj"]
|
[ext_resource type="PackedScene" uid="uid://0duodsosmfpq" path="res://scenes/game/entities/player/player.tscn" id="3_sjgkj"]
|
||||||
[ext_resource type="PackedScene" uid="uid://br7eqr6jomsg4" path="res://scenes/game/map/map.tscn" id="3_vpriv"]
|
[ext_resource type="PackedScene" uid="uid://br7eqr6jomsg4" path="res://scenes/game/map/map.tscn" id="3_vpriv"]
|
||||||
[ext_resource type="PackedScene" uid="uid://41ksceqosqq2" path="res://scenes/game/objects/Vase/vase.tscn" id="4_mot7l"]
|
[ext_resource type="PackedScene" uid="uid://41ksceqosqq2" path="res://scenes/game/objects/Vase/vase.tscn" id="4_mot7l"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://sgnp11xty7i1" path="res://scenes/game/collectionArea/collectionArea.tscn" id="5_8c8da"]
|
||||||
|
|
||||||
[node name="mainGame" type="Node2D"]
|
[node name="mainGame" type="Node2D"]
|
||||||
script = ExtResource("1_napbe")
|
script = ExtResource("1_napbe")
|
||||||
|
|
@ -18,4 +19,14 @@ y_sort_enabled = false
|
||||||
|
|
||||||
[node name="Vase" parent="." instance=ExtResource("4_mot7l")]
|
[node name="Vase" parent="." instance=ExtResource("4_mot7l")]
|
||||||
position = Vector2(32, 24)
|
position = Vector2(32, 24)
|
||||||
value = 985
|
|
||||||
|
[node name="Vase2" parent="." instance=ExtResource("4_mot7l")]
|
||||||
|
position = Vector2(-8, 24)
|
||||||
|
|
||||||
|
[node name="StormTimer" type="Timer" parent="."]
|
||||||
|
one_shot = true
|
||||||
|
|
||||||
|
[node name="CollectionArea" parent="." instance=ExtResource("5_8c8da")]
|
||||||
|
position = Vector2(-272, -16)
|
||||||
|
|
||||||
|
[connection signal="timeout" from="StormTimer" to="." method="_on_storm_timer_timeout"]
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@
|
||||||
radius = 12.0
|
radius = 12.0
|
||||||
|
|
||||||
[node name="Vase" instance=ExtResource("1_fkdlr")]
|
[node name="Vase" instance=ExtResource("1_fkdlr")]
|
||||||
|
light_mask = 8
|
||||||
|
visibility_layer = 8
|
||||||
y_sort_enabled = true
|
y_sort_enabled = true
|
||||||
|
|
||||||
[node name="CollisionShape2D" parent="." index="0"]
|
[node name="CollisionShape2D" parent="." index="0"]
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,6 @@ const heavy = 50
|
||||||
var player = null
|
var player = null
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
#if player != null and weight >= heavy :
|
|
||||||
#global_position.y = move_toward(global_position.y, player.global_position.y, 5)
|
|
||||||
#global_position.x = move_toward(global_position.x, player.global_position.x, 5)
|
|
||||||
|
|
||||||
#if player != null and weight <= heavy :
|
|
||||||
if player != null:
|
if player != null:
|
||||||
global_position.y = move_toward(global_position.y, player.global_position.y, 3)
|
global_position.y = move_toward(global_position.y, player.global_position.y, 3)
|
||||||
global_position.x = move_toward(global_position.x, player.global_position.x, 3)
|
global_position.x = move_toward(global_position.x, player.global_position.x, 3)
|
||||||
|
|
@ -28,3 +23,9 @@ func drop():
|
||||||
|
|
||||||
func getWeight():
|
func getWeight():
|
||||||
return weight
|
return weight
|
||||||
|
|
||||||
|
func getValue():
|
||||||
|
return value
|
||||||
|
|
||||||
|
func isCarryied():
|
||||||
|
return player != null
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,3 @@
|
||||||
keys,de,en
|
keys,de,en
|
||||||
START_GAME,Spielen,Play
|
START_GAME,Spielen,Play
|
||||||
|
MONEY,Geld,Money
|
||||||
|
|
|
||||||
|
Loading…
Add table
Add a link
Reference in a new issue