mirror of
https://github.com/creyD/ludum_dare_46.git
synced 2026-06-11 21:22:22 +02:00
Removed slimeboss script for now
This commit is contained in:
@@ -1,94 +1,3 @@
|
||||
extends KinematicBody2D
|
||||
class_name SlimeBoss
|
||||
"""
|
||||
This is an example player controller script created by Paul
|
||||
"""
|
||||
var velocity := Vector2.ZERO
|
||||
# This is how you export variables with ranges to the editor window
|
||||
export(bool) var debug := false
|
||||
export(int, 0, 500) var ACCELERATION := 450
|
||||
# Reference for the current player
|
||||
|
||||
onready var player_stats := $Stats
|
||||
onready var debug_label := $DebugLabel
|
||||
#onready var animation_player := $AnimationPlayer
|
||||
#var animation_tree := $AnimationTree
|
||||
#onready var animation_state = animation_tree.get("parameters/playback")
|
||||
|
||||
enum moveState{
|
||||
MOVE,
|
||||
HIT
|
||||
}
|
||||
|
||||
var movementState = moveState.MOVE
|
||||
|
||||
var damage_per_second := 0.0
|
||||
var totaldamage := 0.0
|
||||
|
||||
func _debug_update():
|
||||
debug_label.text = str(player_stats.health) + "/" + str(player_stats.max_health) + " HP\n"
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
totaldamage+=damage_per_second*delta
|
||||
player_stats.speed+=10*delta
|
||||
while(totaldamage>1):
|
||||
totaldamage-=1
|
||||
player_stats.health-=1
|
||||
while(totaldamage<-1):
|
||||
totaldamage+=1
|
||||
player_stats.health+=1
|
||||
_debug_update()
|
||||
if debug == true:
|
||||
match movementState:
|
||||
moveState.MOVE:
|
||||
movement_move(delta)
|
||||
moveState.HIT:
|
||||
movement_hit()
|
||||
|
||||
move()
|
||||
|
||||
# IMPORTANT: If you are using move_and_slide don't multiply by delta
|
||||
# Godots physics system does that internally
|
||||
# In move_and_collide(...) you have to multiply by delta.
|
||||
func move():
|
||||
move_and_slide(velocity)
|
||||
|
||||
func movement_move(delta):
|
||||
var input_vector = Vector2.ZERO
|
||||
# This is a clever way to handle directional input
|
||||
# Input.get_action_strength(...) returns a value between 0 and 1 depending
|
||||
# on how strong the controller direction is pressed
|
||||
# For keyboards it always returns 1 if pressed and 0 if not
|
||||
# The actions are custom and defined in the project settings
|
||||
input_vector.x = Input.get_action_strength("right") - Input.get_action_strength("left")
|
||||
input_vector.y = Input.get_action_strength("down") - Input.get_action_strength("up")
|
||||
input_vector = input_vector.normalized()
|
||||
|
||||
if input_vector == Vector2.ZERO:
|
||||
#animation_state.travel("idle")
|
||||
velocity = Vector2.ZERO
|
||||
else:
|
||||
velocity = velocity.move_toward(player_stats.speed * input_vector, ACCELERATION * delta)
|
||||
if Input.is_action_just_pressed("roll"):
|
||||
pass
|
||||
elif Input.is_action_just_pressed("attack"):
|
||||
pass
|
||||
|
||||
func movement_hit():
|
||||
velocity = Vector2.ZERO
|
||||
|
||||
func hit_finished():
|
||||
movementState = moveState.MOVE
|
||||
|
||||
func _on_Stats_no_health():
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_Hurtbox_area_entered(area):
|
||||
player_stats.health-=area.damage
|
||||
damage_per_second = damage_per_second + area.damage
|
||||
|
||||
|
||||
func _on_Hurtbox_area_exited(area):
|
||||
damage_per_second = damage_per_second - area.damage
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
[gd_scene load_steps=19 format=2]
|
||||
[gd_scene load_steps=18 format=2]
|
||||
|
||||
[ext_resource path="res://Overlap/HurtHit_Box/Hurtbox.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://Overlap/HurtHit_Box/Hitbox.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://Overlap/Stats/Stats.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://Boss/SlimeBoss/SlimeBoss.gd" type="Script" id=4]
|
||||
[ext_resource path="res://Boss/SlimeBoss/Animations/move_down.png" type="Texture" id=5]
|
||||
[ext_resource path="res://Boss/SlimeBoss/Animations/move_right.png" type="Texture" id=6]
|
||||
[ext_resource path="res://Boss/SlimeBoss/States/Motion/Idle.gd" type="Script" id=7]
|
||||
@@ -325,17 +324,16 @@ tracks/4/keys = {
|
||||
}
|
||||
|
||||
[node name="SlimeBoss" type="KinematicBody2D"]
|
||||
script = ExtResource( 4 )
|
||||
__meta__ = {
|
||||
"_edit_group_": true
|
||||
}
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
position = Vector2( -5, -20 )
|
||||
texture = ExtResource( 6 )
|
||||
flip_h = true
|
||||
vframes = 7
|
||||
hframes = 11
|
||||
position = Vector2( 0, -20 )
|
||||
texture = ExtResource( 5 )
|
||||
vframes = 10
|
||||
hframes = 24
|
||||
frame = 227
|
||||
|
||||
[node name="Hitbox" parent="." instance=ExtResource( 2 )]
|
||||
visible = false
|
||||
@@ -390,9 +388,6 @@ anims/MoveDown = SubResource( 4 )
|
||||
anims/MoveLeft = SubResource( 6 )
|
||||
anims/MoveRight = SubResource( 5 )
|
||||
anims/MoveUp = SubResource( 7 )
|
||||
[connection signal="area_entered" from="Hurtbox" to="." method="_on_Hurtbox_area_entered"]
|
||||
[connection signal="area_exited" from="Hurtbox" to="." method="_on_Hurtbox_area_exited"]
|
||||
[connection signal="no_health" from="Stats" to="." method="_on_Stats_no_health"]
|
||||
|
||||
[editable path="Hitbox"]
|
||||
|
||||
|
||||
@@ -21,15 +21,15 @@ region_enabled = true
|
||||
region_rect = Rect2( 0, 0, 1280, 720 )
|
||||
|
||||
[node name="Background" parent="." instance=ExtResource( 7 )]
|
||||
frame = 33
|
||||
frame = 29
|
||||
|
||||
[node name="FloorTileMap" type="TileMap" parent="."]
|
||||
visible = false
|
||||
modulate = Color( 1, 1, 1, 0.454902 )
|
||||
position = Vector2( 16, 16 )
|
||||
tile_set = ExtResource( 3 )
|
||||
cell_size = Vector2( 32, 32 )
|
||||
format = 1
|
||||
tile_data = PoolIntArray( -1, -1610612689, 4, -65536, -1610612689, 196609, -65535, 47, 196609, -65534, 47, 196609, -65533, 47, 196609, -65532, 47, 196609, -65531, 47, 196609, -65530, 47, 196609, -65529, 47, 196609, -65528, 47, 196609, -65527, 47, 196609, -65526, 47, 196609, -65525, 47, 196609, -65524, 47, 196609, -65523, 47, 196609, -65522, 47, 7, 65535, -1610612689, 65539, 14, 47, 65539, 131071, 47, 65539, 65550, 47, 65539, 196607, 47, 65539, 131086, -1610612689, 65539, 262143, 47, 65539, 196622, -1610612689, 65539, 327679, 47, 65539, 262158, -1610612689, 65539, 393215, 47, 65539, 327694, 47, 65539, 458751, -1610612689, 131076, 393216, -1610612689, 1, 393217, -1610612689, 1, 393218, -1610612689, 1, 393219, -1610612689, 1, 393220, -1610612689, 1, 393221, -1610612689, 1, 393222, -1610612689, 1, 393223, -1610612689, 1, 393224, -1610612689, 1, 393225, -1610612689, 1, 393226, -1610612689, 1, 393227, -1610612689, 1, 393228, -1610612689, 1, 393229, -1610612689, 1, 393230, 47, 131079, 524287, -1610612689, 131072, 458752, 47, 131073, 458753, 47, 131073, 458754, 47, 131073, 458755, 47, 131073, 458756, 47, 131073, 458757, 47, 131073, 458758, 47, 131073, 458759, 47, 131073, 458760, 47, 131073, 458761, 47, 131073, 458762, 47, 131073, 458763, 47, 131073, 458764, 47, 131073, 458765, 47, 131073, 458766, 47, 131074 )
|
||||
tile_data = PoolIntArray( -1, -1610612689, 4, -65536, -1610612689, 196609, -65535, -1610612689, 196609, -65534, -1610612689, 196609, -65533, -1610612689, 196609, -65532, -1610612689, 196609, -65531, -1610612689, 196609, -65530, -1610612689, 196609, -65529, -1610612689, 196609, -65528, -1610612689, 196609, -65527, -1610612689, 196609, -65526, -1610612689, 196609, -65525, -1610612689, 196609, -65524, -1610612689, 196609, -65523, -1610612689, 196610, -65522, -1610612720, 131073, 65535, -1610612689, 65539, 14, -1610612689, 3, 131071, 47, 65539, 65550, -1610612689, 65539, 196607, 47, 65539, 131086, -1610612689, 65539, 262143, 47, 65539, 196622, -1610612689, 65539, 327679, 47, 65539, 262158, -1610612689, 65539, 393215, 47, 65539, 327694, -1610612689, 65539, 458751, -1610612689, 131076, 393216, -1610612689, 1, 393217, -1610612689, 1, 393218, -1610612689, 1, 393219, -1610612689, 1, 393220, -1610612689, 1, 393221, -1610612689, 1, 393222, -1610612689, 1, 393223, -1610612689, 1, 393224, -1610612689, 1, 393225, -1610612689, 1, 393226, -1610612689, 1, 393227, -1610612689, 1, 393228, -1610612689, 1, 393229, -1610612689, 1, 393230, -1610612689, 131079, 524287, -1610612689, 131072, 458752, 47, 131073, 458753, 47, 131073, 458754, 47, 131073, 458755, 47, 131073, 458756, 47, 131073, 458757, 47, 131073, 458758, 47, 131073, 458759, 47, 131073, 458760, 47, 131073, 458761, 47, 131073, 458762, 47, 131073, 458763, 47, 131073, 458764, 47, 131073, 458765, 47, 131073, 458766, -1610612689, 131074 )
|
||||
__meta__ = {
|
||||
"_edit_group_": true,
|
||||
"_edit_lock_": true
|
||||
@@ -39,7 +39,7 @@ __meta__ = {
|
||||
position = Vector2( 152, 120 )
|
||||
|
||||
[node name="Bonfire" parent="YSort" instance=ExtResource( 10 )]
|
||||
position = Vector2( 264, -24 )
|
||||
position = Vector2( 265.543, -16 )
|
||||
|
||||
[node name="Player" parent="YSort" instance=ExtResource( 1 )]
|
||||
position = Vector2( 168, -12.7226 )
|
||||
@@ -59,3 +59,4 @@ visible = false
|
||||
ObjectParent = NodePath("../..")
|
||||
|
||||
[node name="SlimeBoss" parent="." instance=ExtResource( 8 )]
|
||||
position = Vector2( 88, 75.8131 )
|
||||
|
||||
Reference in New Issue
Block a user