Add HP Logic
parent
f3dd6ee65a
commit
7ee336c7d5
|
@ -20,7 +20,7 @@ compress/hdr_mode=0
|
||||||
compress/bptc_ldr=0
|
compress/bptc_ldr=0
|
||||||
compress/normal_map=0
|
compress/normal_map=0
|
||||||
flags/repeat=0
|
flags/repeat=0
|
||||||
flags/filter=true
|
flags/filter=false
|
||||||
flags/mipmaps=false
|
flags/mipmaps=false
|
||||||
flags/anisotropic=false
|
flags/anisotropic=false
|
||||||
flags/srgb=2
|
flags/srgb=2
|
||||||
|
@ -31,5 +31,5 @@ process/invert_color=false
|
||||||
process/normal_map_invert_y=false
|
process/normal_map_invert_y=false
|
||||||
stream=false
|
stream=false
|
||||||
size_limit=0
|
size_limit=0
|
||||||
detect_3d=true
|
detect_3d=false
|
||||||
svg/scale=1.0
|
svg/scale=1.0
|
||||||
|
|
|
@ -8,6 +8,16 @@
|
||||||
|
|
||||||
config_version=4
|
config_version=4
|
||||||
|
|
||||||
|
_global_script_classes=[ {
|
||||||
|
"base": "EditorVCSInterface",
|
||||||
|
"class": "GitAPI",
|
||||||
|
"language": "NativeScript",
|
||||||
|
"path": "res://addons/godot-git-plugin/git_api.gdns"
|
||||||
|
} ]
|
||||||
|
_global_script_class_icons={
|
||||||
|
"GitAPI": ""
|
||||||
|
}
|
||||||
|
|
||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="LD54"
|
config/name="LD54"
|
||||||
|
@ -38,7 +48,7 @@ version_control_plugin_name="GitAPI"
|
||||||
|
|
||||||
[gdnative]
|
[gdnative]
|
||||||
|
|
||||||
singletons=[ ]
|
singletons=[ "res://addons/godot-git-plugin/git_api.gdnlib" ]
|
||||||
|
|
||||||
[global]
|
[global]
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,10 @@ extends Node
|
||||||
var GAME_SCENE = preload("res://src/scenes/game/Game.tscn")
|
var GAME_SCENE = preload("res://src/scenes/game/Game.tscn")
|
||||||
|
|
||||||
var playing = true
|
var playing = true
|
||||||
var health = 0
|
var health = 2
|
||||||
|
|
||||||
func add_health(amount):
|
func add_health(amount):
|
||||||
health = clamp(health + amount, 0, 3)
|
health = clamp(health + amount, 0, 3)
|
||||||
emit_signal("health_update")
|
get_tree().get_root().get_node("Game/UI/Health/HealthSprite").frame = health
|
||||||
if health == 0:
|
if health == 0:
|
||||||
pass # TODO endgame
|
pass # TODO endgame
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=14 format=2]
|
[gd_scene load_steps=16 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/scenes/menu/background/background.png" type="Texture" id=1]
|
[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/sprites/background_houses.png" type="Texture" id=2]
|
||||||
|
@ -9,12 +9,14 @@
|
||||||
[ext_resource path="res://src/scenes/game/sprites/health/1.png" type="Texture" id=7]
|
[ext_resource path="res://src/scenes/game/sprites/health/1.png" type="Texture" id=7]
|
||||||
[ext_resource path="res://src/scenes/game/sprites/health/2.png" type="Texture" id=8]
|
[ext_resource path="res://src/scenes/game/sprites/health/2.png" type="Texture" id=8]
|
||||||
[ext_resource path="res://src/scenes/game/sprites/health/0.png" type="Texture" id=9]
|
[ext_resource path="res://src/scenes/game/sprites/health/0.png" type="Texture" id=9]
|
||||||
|
[ext_resource path="res://icon.png" type="Texture" id=10]
|
||||||
|
[ext_resource path="res://src/scenes/game/game.gd" type="Script" id=11]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id=2]
|
[sub_resource type="RectangleShape2D" id=2]
|
||||||
extents = Vector2( 10, 60 )
|
extents = Vector2( 10, 60 )
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id=3]
|
[sub_resource type="RectangleShape2D" id=3]
|
||||||
extents = Vector2( 140, 10.25 )
|
extents = Vector2( 140, 10.125 )
|
||||||
|
|
||||||
[sub_resource type="DynamicFont" id=1]
|
[sub_resource type="DynamicFont" id=1]
|
||||||
size = 8
|
size = 8
|
||||||
|
@ -29,6 +31,7 @@ animations = [ {
|
||||||
} ]
|
} ]
|
||||||
|
|
||||||
[node name="Game" type="Node"]
|
[node name="Game" type="Node"]
|
||||||
|
script = ExtResource( 11 )
|
||||||
|
|
||||||
[node name="View" type="Node2D" parent="."]
|
[node name="View" type="Node2D" parent="."]
|
||||||
|
|
||||||
|
@ -59,7 +62,7 @@ position = Vector2( 160, 10.25 )
|
||||||
shape = SubResource( 3 )
|
shape = SubResource( 3 )
|
||||||
|
|
||||||
[node name="CollisionShape2D4" type="CollisionShape2D" parent="View/Background/Houses"]
|
[node name="CollisionShape2D4" type="CollisionShape2D" parent="View/Background/Houses"]
|
||||||
position = Vector2( 160, 110 )
|
position = Vector2( 160, 109.875 )
|
||||||
shape = SubResource( 3 )
|
shape = SubResource( 3 )
|
||||||
|
|
||||||
[node name="Player" parent="View" instance=ExtResource( 5 )]
|
[node name="Player" parent="View" instance=ExtResource( 5 )]
|
||||||
|
@ -88,7 +91,14 @@ text = "spell modifiers"
|
||||||
margin_right = 40.0
|
margin_right = 40.0
|
||||||
margin_bottom = 40.0
|
margin_bottom = 40.0
|
||||||
|
|
||||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="UI/Health"]
|
[node name="HealthSprite" type="AnimatedSprite" parent="UI/Health"]
|
||||||
position = Vector2( 70, 145 )
|
position = Vector2( 70, 145 )
|
||||||
frames = SubResource( 4 )
|
frames = SubResource( 4 )
|
||||||
|
frame = 2
|
||||||
|
centered = false
|
||||||
|
|
||||||
|
[node name="PlayerIcon" type="Sprite" parent="UI"]
|
||||||
|
position = Vector2( 20, 134 )
|
||||||
|
scale = Vector2( 0.5, 0.5 )
|
||||||
|
texture = ExtResource( 10 )
|
||||||
centered = false
|
centered = false
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
Global.add_health(1)
|
Loading…
Reference in New Issue