diff --git a/src/Boss/Boss_template.tscn b/src/Boss/Boss_template.tscn index fb4ea17..85e3a48 100644 --- a/src/Boss/Boss_template.tscn +++ b/src/Boss/Boss_template.tscn @@ -1,10 +1,11 @@ -[gd_scene load_steps=9 format=2] +[gd_scene load_steps=10 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/Boss_template.gd" type="Script" id=4] [ext_resource path="res://testSprites/white_boss_dog.png" type="Texture" id=5] +[ext_resource path="res://Overlap/Kind.tscn" type="PackedScene" id=6] [sub_resource type="CapsuleShape2D" id=1] radius = 18.0 @@ -21,6 +22,8 @@ height = 15.0 [node name="Boss_template" type="KinematicBody2D"] script = ExtResource( 4 ) +[node name="Kind" parent="." instance=ExtResource( 6 )] + [node name="Sprite" type="Sprite" parent="."] position = Vector2( 3.13451, -20.1418 ) scale = Vector2( 2, 2 ) diff --git a/src/Maps/Grid.gd b/src/Maps/Grid.gd new file mode 100644 index 0000000..f59f13c --- /dev/null +++ b/src/Maps/Grid.gd @@ -0,0 +1,124 @@ +extends Node + +const Kind = preload("res://Overlap/Kind.gd") # Relative path + + +var object_grid : Array = [] +var prio_grid : Array = [] +var used_grid : Array = [] +var time_passed := 0.0 +var offset +export(float,0,42.0) var refresh_rate = 5.0 + + +func _draw_object_grid(): + for y in range(7): + var stri = "" + for x in range(14): + stri += str(object_grid[x][y]) + " " + print(stri) + print() + +func _draw_prio_grid(): + for y in range(7): + var stri = "" + for x in range(14): + stri += str(prio_grid[x][y]) + " " + print(stri) + print() + +func _reset_grids(): + for x in range(14): + for y in range(7): + var lulul = object_grid[x][y].back() + while (object_grid[x][y].back()!=Kind.FIELD) and (Kind.WALL != object_grid[x][y].back()): + object_grid[x][y].pop_back() + while (prio_grid[x][y].back()!=Kind.TERMINAL_SYMBOL): + prio_grid[x][y].pop_back() + +func _ready(): + var walls = get_tree().current_scene.get_child(1) + offset = walls.global_position + #todo put in grid_lul + for x in range(14): + object_grid.push_back([]) + prio_grid.push_back([]) + used_grid.push_back([]) + for y in range(7): + object_grid[x].push_back([Kind.FIELD]) + prio_grid[x].push_back([Kind.TERMINAL_SYMBOL]) + used_grid[x].push_back(false) + + for tile in walls.get_used_cells(): + if(_is_in_grid(tile)): + object_grid[tile.x][tile.y][0] = Kind.WALL + + _update_grid() + + +func _reset_history(): + for x in range(14): + for y in range(7): + used_grid[x][y] = false + +func countTargets(table): + for x in range(14): + for y in range(7): + for i in prio_grid[x][y]: + if i == Kind.TERMINAL_SYMBOL: + continue + table[i]+=1 + return table + +func _pixel_to_grid_coords(pixel : Vector2) -> Vector2: + var new_coords : Vector2 + new_coords.x = floor((pixel.x-offset.x)/32.0) + new_coords.y = floor((pixel.y-offset.y)/32.0) + return new_coords + +func _is_in_grid(grid_coords : Vector2) -> bool: + if(grid_coords.x<0): + return false + if(grid_coords.x>13): + return false + if(grid_coords.y<0): + return false + if(grid_coords.y>6): + return false + return true + +func get_nearest(position, kind): + var list = [] + for x in range(14): + for y in range(7): + for i in prio_grid[x][y]: + if(i == kind): + list.append([x,y]) + var dist = [] + for field in list: + var tmp = sqrt(pow(position[0]-field[0],2)+pow(position[1]-field[1],2)) + dist.append(tmp) + var mini = 0 + for i in range(1, dist.size()): + if(dist[i] refresh_rate): + time_passed -= refresh_rate + _update_grid() + time_passed += delta + diff --git a/src/Maps/Grid.tscn b/src/Maps/Grid.tscn new file mode 100644 index 0000000..fcea5cc --- /dev/null +++ b/src/Maps/Grid.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://Maps/Grid.gd" type="Script" id=1] + +[node name="Grid" type="Node"] +script = ExtResource( 1 ) diff --git a/src/Objects/Banana/Banana.tscn b/src/Objects/Banana/Banana.tscn index 8b4d30e..4e28045 100644 --- a/src/Objects/Banana/Banana.tscn +++ b/src/Objects/Banana/Banana.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=6 format=2] [ext_resource path="res://Overlap/HurtHit_Box/Hurtbox.tscn" type="PackedScene" id=1] [ext_resource path="res://Objects/Banana/Bannana.gd" type="Script" id=2] [ext_resource path="res://testSprites/bannane.png" type="Texture" id=3] +[ext_resource path="res://Overlap/Kind.tscn" type="PackedScene" id=4] [sub_resource type="CapsuleShape2D" id=1] radius = 7.54726 @@ -11,6 +12,10 @@ height = 12.1493 [node name="Banana" type="Node2D"] script = ExtResource( 2 ) +[node name="Kind" parent="." instance=ExtResource( 4 )] +general = 2 +kind = 10 + [node name="Sprite" type="Sprite" parent="."] position = Vector2( 1.54256, -4.73786 ) texture = ExtResource( 3 ) diff --git a/src/Objects/Barrel/Barrel.tscn b/src/Objects/Barrel/Barrel.tscn index a90bebd..942399f 100644 --- a/src/Objects/Barrel/Barrel.tscn +++ b/src/Objects/Barrel/Barrel.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=6 format=2] +[gd_scene load_steps=7 format=2] [ext_resource path="res://Overlap/HurtHit_Box/Hurtbox.tscn" type="PackedScene" id=1] [ext_resource path="res://Objects/Barrel/Barrel.gd" type="Script" id=2] [ext_resource path="res://testSprites/Fass.png" type="Texture" id=3] +[ext_resource path="res://Overlap/Kind.tscn" type="PackedScene" id=4] [sub_resource type="CapsuleShape2D" id=1] radius = 10.7634 @@ -15,6 +16,10 @@ height = 8.78242 [node name="Barrel" type="StaticBody2D"] script = ExtResource( 2 ) +[node name="Kind" parent="." instance=ExtResource( 4 )] +general = 1 +kind = 9 + [node name="Sprite" type="Sprite" parent="."] position = Vector2( 0.244171, -10.0111 ) texture = ExtResource( 3 ) diff --git a/src/Objects/Bonfire/Bonfire.tscn b/src/Objects/Bonfire/Bonfire.tscn index 99ca9e5..24a2e4d 100644 --- a/src/Objects/Bonfire/Bonfire.tscn +++ b/src/Objects/Bonfire/Bonfire.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=8 format=2] +[gd_scene load_steps=9 format=2] [ext_resource path="res://Overlap/HurtHit_Box/Hurtbox.tscn" type="PackedScene" id=1] [ext_resource path="res://Objects/Bonfire/Bonfire.gd" type="Script" id=2] [ext_resource path="res://testSprites/Bonfire.png" type="Texture" id=3] [ext_resource path="res://Overlap/HurtHit_Box/Hitbox.tscn" type="PackedScene" id=4] +[ext_resource path="res://Overlap/Kind.tscn" type="PackedScene" id=5] [sub_resource type="CapsuleShape2D" id=1] radius = 7.76762 @@ -19,6 +20,10 @@ radius = 32.0 [node name="Bonfire" type="StaticBody2D"] script = ExtResource( 2 ) +[node name="Kind" parent="." instance=ExtResource( 5 )] +general = 1 +kind = 8 + [node name="Sprite" type="Sprite" parent="."] position = Vector2( 0.22036, -4.18694 ) texture = ExtResource( 3 ) diff --git a/src/Objects/Heart/Heart.tscn b/src/Objects/Heart/Heart.tscn index d540388..975d0f7 100644 --- a/src/Objects/Heart/Heart.tscn +++ b/src/Objects/Heart/Heart.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=6 format=2] [ext_resource path="res://Overlap/HurtHit_Box/Hurtbox.tscn" type="PackedScene" id=1] [ext_resource path="res://Objects/Heart/Heart.gd" type="Script" id=2] [ext_resource path="res://testSprites/Herz.png" type="Texture" id=3] +[ext_resource path="res://Overlap/Kind.tscn" type="PackedScene" id=4] [sub_resource type="CapsuleShape2D" id=1] radius = 7.43707 @@ -11,6 +12,10 @@ height = 2.89399 [node name="Heart" type="Node2D"] script = ExtResource( 2 ) +[node name="Kind" parent="." instance=ExtResource( 4 )] +general = 1 +kind = 7 + [node name="Sprite" type="Sprite" parent="."] position = Vector2( 0.22036, -4.18694 ) texture = ExtResource( 3 ) diff --git a/src/Objects/Rubies/Blue.tscn b/src/Objects/Rubies/Blue.tscn index cdc6a76..2826e60 100644 --- a/src/Objects/Rubies/Blue.tscn +++ b/src/Objects/Rubies/Blue.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=6 format=2] [ext_resource path="res://Overlap/HurtHit_Box/Hurtbox.tscn" type="PackedScene" id=1] [ext_resource path="res://Objects/Rubies/Rubies.gd" type="Script" id=2] [ext_resource path="res://testSprites/blue_Rubi.png" type="Texture" id=3] +[ext_resource path="res://Overlap/Kind.tscn" type="PackedScene" id=4] [sub_resource type="CapsuleShape2D" id=1] radius = 7.43707 @@ -11,6 +12,10 @@ height = 2.89399 [node name="Blue" type="Node2D"] script = ExtResource( 2 ) +[node name="Kind" parent="." instance=ExtResource( 4 )] +general = 1 +kind = 5 + [node name="Sprite" type="Sprite" parent="."] position = Vector2( 0.22036, -4.18694 ) texture = ExtResource( 3 ) diff --git a/src/Objects/Rubies/Green.tscn b/src/Objects/Rubies/Green.tscn index 2ef1a91..b0a81d1 100644 --- a/src/Objects/Rubies/Green.tscn +++ b/src/Objects/Rubies/Green.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=6 format=2] [ext_resource path="res://Overlap/HurtHit_Box/Hurtbox.tscn" type="PackedScene" id=1] [ext_resource path="res://Objects/Rubies/Rubies.gd" type="Script" id=2] [ext_resource path="res://testSprites/green_Rubi.png" type="Texture" id=3] +[ext_resource path="res://Overlap/Kind.tscn" type="PackedScene" id=4] [sub_resource type="CapsuleShape2D" id=1] radius = 7.43707 @@ -11,6 +12,10 @@ height = 2.89399 [node name="Green" type="Node2D"] script = ExtResource( 2 ) +[node name="Kind" parent="." instance=ExtResource( 4 )] +general = 1 +kind = 6 + [node name="Sprite" type="Sprite" parent="."] position = Vector2( 0.22036, -4.18694 ) texture = ExtResource( 3 ) diff --git a/src/Objects/Rubies/Red.tscn b/src/Objects/Rubies/Red.tscn index 2001ecd..bc3bd2f 100644 --- a/src/Objects/Rubies/Red.tscn +++ b/src/Objects/Rubies/Red.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=6 format=2] [ext_resource path="res://Overlap/HurtHit_Box/Hurtbox.tscn" type="PackedScene" id=1] [ext_resource path="res://Objects/Rubies/Rubies.gd" type="Script" id=2] [ext_resource path="res://testSprites/red_Rubi.png" type="Texture" id=3] +[ext_resource path="res://Overlap/Kind.tscn" type="PackedScene" id=4] [sub_resource type="CapsuleShape2D" id=1] radius = 7.43707 @@ -11,6 +12,10 @@ height = 2.89399 [node name="Red" type="Node2D"] script = ExtResource( 2 ) +[node name="Kind" parent="." instance=ExtResource( 4 )] +general = 1 +kind = 4 + [node name="Sprite" type="Sprite" parent="."] position = Vector2( 0.22036, -4.18694 ) texture = ExtResource( 3 ) diff --git a/src/Objects/Slime/Slime.tscn b/src/Objects/Slime/Slime.tscn index 70dc294..1a0c3d4 100644 --- a/src/Objects/Slime/Slime.tscn +++ b/src/Objects/Slime/Slime.tscn @@ -1,13 +1,18 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://testSprites/slime.png" type="Texture" id=1] [ext_resource path="res://Overlap/HurtHit_Box/Hurtbox.tscn" type="PackedScene" id=2] +[ext_resource path="res://Overlap/Kind.tscn" type="PackedScene" id=3] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 16, 16 ) [node name="Slime" type="Node2D"] +[node name="Kind" parent="." instance=ExtResource( 3 )] +general = 2 +kind = 10 + [node name="Sprite" type="Sprite" parent="."] texture = ExtResource( 1 ) diff --git a/src/Objects/Torch/Torch.gd b/src/Objects/Torch/Torch.gd index b9c999d..31df32b 100644 --- a/src/Objects/Torch/Torch.gd +++ b/src/Objects/Torch/Torch.gd @@ -1,4 +1,4 @@ -extends StaticBody2D +extends Node2D export(int, 1, 5) var lifePoints = 3 export(int, 1, 30) var spawnRate = 5 @@ -7,13 +7,14 @@ var elapsedTime = 0.0 func _physics_process(delta): elapsedTime += delta - if(elapsedTime>=spawnRate): - elapsedTime-=spawnRate - var Minion = load("") - var world = get_tree().current_scene.get_child(2) - var minion = Minion.instance() - world.add_child(minion) - minion.global_position = global_position + #if(elapsedTime>=spawnRate): + # elapsedTime-=spawnRate + # var Minion = load("") + # var world = get_tree().current_scene.get_child(2) + # #TODO minions + # var minion = Minion.instance() + # world.add_child(minion) + # minion.global_position = global_position func _on_Hurtbox_area_entered(area): diff --git a/src/Objects/Torch/Torch.tscn b/src/Objects/Torch/Torch.tscn index 17920a5..72dcad8 100644 --- a/src/Objects/Torch/Torch.tscn +++ b/src/Objects/Torch/Torch.tscn @@ -4,16 +4,20 @@ [ext_resource path="res://testSprites/fackel.png" type="Texture" id=2] [ext_resource path="res://Objects/Torch/Torch.gd" type="Script" id=3] [ext_resource path="res://Effects/Fire/FireEffect.tscn" type="PackedScene" id=4] +[ext_resource path="res://Overlap/Kind.tscn" type="PackedScene" id=5] [sub_resource type="CapsuleShape2D" id=1] radius = 8.0 height = 12.0 -[node name="Torch" type="StaticBody2D"] +[node name="Torch" type="Node2D"] script = ExtResource( 3 ) [node name="FireEffect" parent="." instance=ExtResource( 4 )] position = Vector2( 1.88936, -12.4698 ) +[node name="Kind" parent="." instance=ExtResource( 5 )] +general = 4 +kind = 2 [node name="Sprite" type="Sprite" parent="."] position = Vector2( 0, -8 ) diff --git a/src/Objects/Traps/Flame.tscn b/src/Objects/Traps/Flame.tscn index eed9fd8..153904f 100644 --- a/src/Objects/Traps/Flame.tscn +++ b/src/Objects/Traps/Flame.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://Overlap/HurtHit_Box/Hitbox.tscn" type="PackedScene" id=1] +[ext_resource path="res://Overlap/Kind.tscn" type="PackedScene" id=2] [ext_resource path="res://testSprites/flame.png" type="Texture" id=3] [sub_resource type="CapsuleShape2D" id=1] @@ -8,6 +9,9 @@ height = 6.36237 [node name="Flame" type="Node2D"] +[node name="Kind" parent="." instance=ExtResource( 2 )] +kind = 10 + [node name="Sprite" type="Sprite" parent="."] position = Vector2( 0.44072, -6.06005 ) texture = ExtResource( 3 ) diff --git a/src/Objects/Traps/Spike.tscn b/src/Objects/Traps/Spike.tscn index 024826f..8991297 100644 --- a/src/Objects/Traps/Spike.tscn +++ b/src/Objects/Traps/Spike.tscn @@ -1,10 +1,9 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=6 format=2] [ext_resource path="res://Overlap/HurtHit_Box/Hitbox.tscn" type="PackedScene" id=1] [ext_resource path="res://Objects/Banana/Bannana.gd" type="Script" id=2] [ext_resource path="res://testSprites/Spike.png" type="Texture" id=3] - - +[ext_resource path="res://Overlap/Kind.tscn" type="PackedScene" id=4] [sub_resource type="CapsuleShape2D" id=1] height = 6.36237 @@ -12,6 +11,9 @@ height = 6.36237 [node name="Spike" type="Node2D"] script = ExtResource( 2 ) +[node name="Kind" parent="." instance=ExtResource( 4 )] +kind = 10 + [node name="Sprite" type="Sprite" parent="."] position = Vector2( 0.220352, -3.63603 ) texture = ExtResource( 3 ) diff --git a/src/Objects/Traps/Sting.tscn b/src/Objects/Traps/Sting.tscn index b102af5..f640195 100644 --- a/src/Objects/Traps/Sting.tscn +++ b/src/Objects/Traps/Sting.tscn @@ -1,10 +1,9 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=6 format=2] [ext_resource path="res://Overlap/HurtHit_Box/Hitbox.tscn" type="PackedScene" id=1] [ext_resource path="res://Objects/Banana/Bannana.gd" type="Script" id=2] [ext_resource path="res://testSprites/Sting.png" type="Texture" id=3] - - +[ext_resource path="res://Overlap/Kind.tscn" type="PackedScene" id=4] [sub_resource type="CapsuleShape2D" id=1] radius = 6.77597 @@ -13,6 +12,9 @@ height = 6.36237 [node name="Sting" type="Node2D"] script = ExtResource( 2 ) +[node name="Kind" parent="." instance=ExtResource( 4 )] +kind = 10 + [node name="Sprite" type="Sprite" parent="."] position = Vector2( 0.44072, -9.03499 ) texture = ExtResource( 3 ) diff --git a/src/Objects/Traps/bear.tscn b/src/Objects/Traps/bear.tscn index 7d23975..006bbd1 100644 --- a/src/Objects/Traps/bear.tscn +++ b/src/Objects/Traps/bear.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=7 format=2] +[gd_scene load_steps=8 format=2] -[ext_resource path="res://Overlap/HurtHit_Box/Hitbox.tscn" type="PackedScene" id=1] -[ext_resource path="res://Objects/Traps/Bear.gd" type="Script" id=2] -[ext_resource path="res://testSprites/falle.png" type="Texture" id=3] -[ext_resource path="res://Overlap/HurtHit_Box/Hurtbox.tscn" type="PackedScene" id=4] +[ext_resource path="res://Objects/Traps/Bear.gd" type="Script" id=1] +[ext_resource path="res://Overlap/HurtHit_Box/Hitbox.tscn" type="PackedScene" id=2] +[ext_resource path="res://Overlap/Kind.tscn" type="PackedScene" id=3] +[ext_resource path="res://testSprites/falle.png" type="Texture" id=4] +[ext_resource path="res://Overlap/HurtHit_Box/Hurtbox.tscn" type="PackedScene" id=5] [sub_resource type="CapsuleShape2D" id=1] height = 9.0 @@ -12,20 +13,23 @@ height = 9.0 height = 9.0 [node name="Bear_trap" type="Node2D"] -script = ExtResource( 2 ) +script = ExtResource( 1 ) + +[node name="Kind" parent="." instance=ExtResource( 3 )] +kind = 10 [node name="Sprite" type="Sprite" parent="."] position = Vector2( -7.62939e-06, 0 ) -texture = ExtResource( 3 ) +texture = ExtResource( 4 ) -[node name="Hitbox" parent="." instance=ExtResource( 1 )] +[node name="Hitbox" parent="." instance=ExtResource( 2 )] collision_layer = 16 [node name="CollisionShape2D" parent="Hitbox" index="0"] rotation = 1.5708 shape = SubResource( 1 ) -[node name="Hurtbox" parent="." instance=ExtResource( 4 )] +[node name="Hurtbox" parent="." instance=ExtResource( 5 )] collision_layer = 32 collision_mask = 0 diff --git a/src/Overlap/AI/AI_Hero.gd b/src/Overlap/AI/AI_Hero.gd new file mode 100644 index 0000000..715fb11 --- /dev/null +++ b/src/Overlap/AI/AI_Hero.gd @@ -0,0 +1,228 @@ +extends KinematicBody2D + +class_name Hero + +const PrioQueue = preload("prio_queue.gd") # Relative path +const Grid = preload("res://Maps/Grid.gd") + +var grid + +enum{ + LENGTH, + WAY +} + +enum{ + STEP, + ROLL, + NOTHING +} + +enum{ + EXECUTING, + AI_MOVE +} + +var ExecutionState = AI_MOVE + +var numbers = [0,0,0,0,0,0,0,0,0,0] +var prios = [7,0,6,5,4,3,2,0,0,4] + +var totalPrioTurn = 0 +var executesTurn = false +var abortProb = 0.01 + +var targetField = [0,0] +var targetFieldUsed = false +#calculates the sum of all present prios +func calcTotalPrio(): + var sum = 0 + var i = Grid.Kind.BOSS + while i != Grid.Kind.TERMINAL_SYMBOL: + if(numbers[i]>0): + sum += prios[i] + i += 1 + return sum + +#calculates the relative porio +func calcRelPrio(index, sum) -> float: + if(sum==0): + return 0.0 + return float(prios[index])/float(sum) + +#calucaltes the prio table of all enemies[0,1) +func calcPrioTable(): + var table = [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0] + numbers = grid.countTargets(numbers) + var lower = 0.0 + var sum = calcTotalPrio() + + var i = 0; + while i != Grid.Kind.TERMINAL_SYMBOL: + if(numbers[i]!=0): + lower += calcRelPrio(i, sum) + table[i] = lower + i += 1 + + return table + +#updates heart and bonfire prio +func adjustPrio(currentHealth, maxHealth): + var prioVal = 10 - (currentHealth/maxHealth)*10 + var bonfire = prioVal + var hearts = prioVal - 1 + if(hearts < 0): + hearts = 0 + prios[Grid.Kind.BONFIRE]=bonfire + prios[Grid.Kind.HEART]=hearts + +#return the enemie which will be attacked +func calcEnemyKind(): + var table = calcPrioTable() + var number = randf() + var i = 0 + while table[i] <= number: + i += 1 + return i + +#returns a move +func getMoveDescription(myPosition : Vector2, targetPositions): + return AStar(myPosition, targetPositions) + + +func getCost(field): + var cost = 0 + for i in grid.prio_grid[field.x][field.y]: + match i: + Grid.Kind.DAMAGE: + cost += prios[Grid.kind.BONFIRE] * 6 + Grid.Kind.SLOW: + cost += 2 + return cost + +#return an heurestic of distance +# curr - current position +# targ - a target position +func h(curr, target): + return min(abs(target[0]-curr[0]),abs(target[0]-curr[0])) + +# currCost - currentCost +# target - position of the field to move to +func g(currCost, target): + return currCost + getCost(target) + +# Returns the list of adjacent nodes +func adjacent(currentPosition, can_roll = false): + var adj := [] + #adj.append([STEP, Vector2(0,0)]) + var p = currentPosition + var pot_adj_step = [[p[0]-1, p[1]-1], [p[0]-1, p[1]-0], [p[0]-1, p[1]+1], + [p[0]+0, p[1]-1], [p[0]+0, p[1]+1], + [p[0]+1, p[1]-1], [p[0]+1, p[1]+0], [p[0]+1, p[1]+1]] + + var pot_adj_roll = [[p[0]-2, p[1]-2], [p[0]-2, p[1]-0], [p[0]-2, p[1]+2], + [p[0]+0, p[1]-2], [p[0]+0, p[1]+2], + [p[0]+2, p[1]-2], [p[0]+2, p[1]+0], [p[0]+2, p[1]+2]] + + for next in pot_adj_step: + if(next[0]<0): + continue + if(next[0]>13): + continue + if(next[1]<0): + continue + if(next[1]>6): + continue + if(grid.used_grid[next[0]][next[1]]): + continue + if(grid.object_grid[next[0]][next[1]][0]!=Grid.Kind.WALL): + adj.append([STEP, Vector2(next[0],next[1])]) + + if not can_roll: + return adj + + for next in pot_adj_roll: + if(next[0]<0): + continue + if(next[0]>13): + continue + if(next[1]<0): + continue + if(next[1]>6): + continue + if(grid.used_grid[next[0]][next[1]]): + continue + if(grid.object_grid[next[0]][next[1]][0]!=Grid.Kind.WALL): + adj.append([ROLL, Vector2(next[0],next[1])]) + + return adj + + +func AStar(source, target): + #swap rtarget and source, when target source istr reached, do inversxse step + # node layout [g+h(x), g(x), current, from, kind] + var tmp = source + source = target + target = tmp + + var Q = PrioQueue.new() + Q.insert([0,0, [source[0], source[1]], [source[0], source[1]], NOTHING] ) + while !Q.empty(): + var node = Q.delMin() + + # Check if reached + if(node[2][0] == target[0] and node[2][1] == target[1]): + return [node[4], node[3]] # 4 is kind | 3 is from + + # Set flag + grid.used_grid[node[2][0]][node[2][1]] = true + var adj_list = adjacent(node[2]) + for i in adj_list: + var move_cost = 0 + if (i[0] == STEP): + move_cost = 1 + else: + move_cost = 2 + + var g_val = g(node[1]+move_cost, i[1]) + var h_val = h(i[1], target) + + #[g+h(x), g(x), current, from, kind] + var new_node = [g_val+h_val, g_val,i[1], node[2], i[0]] + Q.insert(new_node) + + return [NOTHING, [0,0]] + + +func makeMove(delta): + pass + if ExecutionState == AI_MOVE: + var currentPosition = grid._pixel_to_grid_coords(global_position) + var enemyKind = calcEnemyKind() + var targetField = grid.get_nearest(currentPosition, enemyKind) + var MoveAdvice = getMoveDescription(currentPosition, targetField) + print(MoveAdvice) + ExecutionState = EXECUTING + pass + elif ExecutionState == EXECUTING: + if(targetFieldUsed): + pass + var cur = grid._pixel_to_grid_coords(global_position) + var distance = sqrt(pow(cur[0]-targetField[0],2)+ pow(cur[1]-targetField[1],2)) + if(distance<0.5): + targetFieldUsed = false + ExecutionState = AI_MOVE + pass + + +# API Interface for ai_hero -> methods are handled in player.gd +func attac(direction, delta): + pass + + +func roll(direction, delta): + pass + + +func run(direction, delta): + pass diff --git a/src/Overlap/AI/prio_queue.gd b/src/Overlap/AI/prio_queue.gd new file mode 100644 index 0000000..b428bf9 --- /dev/null +++ b/src/Overlap/AI/prio_queue.gd @@ -0,0 +1,53 @@ +extends Node + +# Priority Queue implementation with binary heap +var heaplist +var currentSize + +# node layout [g+h(x), g(x), position] + +func _init(): + heaplist = [[0]] + currentSize = 0 + +func percUp(i): + while floor(i / 2) > 0: + if heaplist[i][0] < heaplist[floor(i / 2)][0]: + var tmp = heaplist[floor(i / 2)] + heaplist[floor(i / 2)] = heaplist[i] + heaplist[i] = tmp + i = floor(i / 2) + +func insert(k): + heaplist.append(k) + currentSize += 1 + percUp(currentSize) + +func percDown(i): + while (i * 2) <= currentSize: + var mc = minChild(i) + if heaplist[i][0] > heaplist[mc][0]: + var tmp = heaplist[i] + heaplist[i] = heaplist[mc] + heaplist[mc] = tmp + i = mc + +func minChild(i): + if i * 2 + 1 > currentSize: + return i * 2 + else: + if heaplist[i*2][0] < heaplist[i*2+1][0]: + return i * 2 + else: + return i * 2 + 1 + +func delMin(): + var retval = heaplist[1] + heaplist[1] = heaplist[currentSize] + heaplist.remove(currentSize - 1) + currentSize -= 1 + percDown(1) + return retval + +func empty(): + return currentSize < 1 diff --git a/src/Overlap/Kind.gd b/src/Overlap/Kind.gd new file mode 100644 index 0000000..d37fa85 --- /dev/null +++ b/src/Overlap/Kind.gd @@ -0,0 +1,28 @@ +extends Node + +enum { + BOSS = 0, + PLAYER, + TORCH, + MINION, + RED, + BLUE, + GREEN, + HEART, + BONFIRE, + BARREL, + TERMINAL_SYMBOL +} + +enum{ + DAMAGE = 0, + HEALING, + SLOW, + WALL, + FIELD +} + +export(int, "DAMAGE","HEALING","SLOW","WALL","FIELD") var general = DAMAGE +export(int,"BOSS","PLAYER","TORCH","MINION","RED","BLUE","GREEN","HEART","BONFIRE","BARREL","TERMINAL_SYMBOL") var kind = BOSS + + diff --git a/src/Overlap/Kind.tscn b/src/Overlap/Kind.tscn new file mode 100644 index 0000000..547647d --- /dev/null +++ b/src/Overlap/Kind.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://Overlap/Kind.gd" type="Script" id=1] + +[node name="Kind" type="Node"] +script = ExtResource( 1 ) diff --git a/src/Overlap/Stats/player_ai.gd b/src/Overlap/Stats/player_ai.gd deleted file mode 100644 index a176ec4..0000000 --- a/src/Overlap/Stats/player_ai.gd +++ /dev/null @@ -1,97 +0,0 @@ -extends Node - -enum{ - BOSS, - TORCH, - MINION, - RED, - BLUE, - GREEN, - HEART, - BONFIRE, - BARREL, - TERMINAL_SYMBOL -} - -enum{ - LENGTH, - WAY -} - -var numbers = [0,0,0,0,0,0,0,0,0] -var prios = [7,6,5,4,3,2,0,0,4] - -var totalPrioTurn = 0 -var executesTurn = false -var abortProb = 0.01 - -func calcTotalPrio(): - var sum = 0 - var i = BOSS - while i != TERMINAL_SYMBOL: - if(numbers[i]>0): - sum += prios[i] - i=i+1 - return sum - -func calcRelPrio(index, sum): - return prios[index]/sum - -func calcPrioTable(): - var table = [0,0,0,0,0,0,0,0,0] - var lower = 0 - var sum = calcTotalPrio() - - var i = 0; - while i != TERMINAL_SYMBOL: - lower += calcRelPrio(i, sum) - table[i] = lower - i = i+1 - - return table - -func adjustPrio(currentHealth, maxHealth): - var prioVal = 10 - (currentHealth/maxHealth)*10 - var bonfire = prioVal - var hearts = prioVal -1 - if(hearts < 0): - hearts = 0 - prios[BONFIRE]=bonfire - prios[HEART]=hearts - -func calcEnemie(): - var table = calcPrioTable() - var number = randf() - var i = TERMINAL_SYMBOL-1 - while table[i] > number: - i=i-1 - return i - -func getMoveDescription(myPosition : Vector2, targetPositions): - var way = AStar(myPosition, targetPositions[0]) - - for i in range(1, targetPositions.size()): - var tmp_way = AStar(myPosition, targetPositions[i]) - if(tmp_way[LENGTH] < way[LENGTH]): - way = tmp_way - return way[WAY] - -func h(curr, targ): - return sqrt(pow(curr,2)+pow(targ,2)) - -func h(curr, position): - - -func AStar(source, target): - pass - -# Called when the node enters the scene tree for the first time. -func _ready(): - prios[BOSS] = 1 - - - - -# Called every frame. 'delta' is the elapsed time since the previous frame. -#func _process(delta): -# pass diff --git a/src/Player/Player.gd b/src/Player/Player.gd index 6de2db7..c7f80f6 100644 --- a/src/Player/Player.gd +++ b/src/Player/Player.gd @@ -1,4 +1,4 @@ -extends KinematicBody2D +extends Hero class_name Player """ This is an example player controller script created by Paul @@ -27,7 +27,8 @@ export(String, FILE, "*.tscn,*.scn") var title_scene = "" enum moveState{ MOVE, ROLL, - HIT + HIT, + IDLE } @@ -43,14 +44,16 @@ var experience := 0.0 func _debug_update(): debug_label.text = str(player_stats.health) + "/" + str(player_stats.max_health) + " HP\n" + str(currency) + " €" +func _ready(): + grid = get_tree().current_scene.get_child(3) func _physics_process(delta): totaldamage+=(damage_per_second - heal_per_second)*delta player_stats.speed+=10*delta while(totaldamage>1): - totaldamage-=1 + totaldamage -= 1 player_stats.health-=1 - while(totaldamage<-1): + while(totaldamage < -1): totaldamage+=1 player_stats.health+=1 _debug_update() @@ -64,6 +67,15 @@ func _physics_process(delta): movement_hit() $"Effects/HealEffect".emitting = heal_per_second > 0 + elif movementState == moveState.ROLL: + movement_roll() + elif movementState == moveState.HIT: + movement_hit() + elif movementState == moveState.IDLE: + movement_idle() + else: + movement_run(Vector2(0,0), delta) + makeMove(delta) move() # IMPORTANT: If you are using move_and_slide don't multiply by delta @@ -71,7 +83,45 @@ func _physics_process(delta): # In move_and_collide(...) you have to multiply by delta. func move(): move_and_slide(velocity) + + +func set_animation_tree_vector(): + animation_tree.set("parameters/idle/blend_position", rollvector) + animation_tree.set("parameters/hit/blend_position", rollvector) + animation_tree.set("parameters/roll/blend_position", rollvector) + animation_tree.set("parameters/run/blend_position", rollvector) + + +# API Interface for ai_hero +func attac(direction, delta): + direction = direction.normalized() + rollvector = direction + set_animation_tree_vector() + movementState = moveState.HIT + + +# API Interface for ai_hero +func roll(direction, delta): + direction = direction.normalized() + rollvector = direction + set_animation_tree_vector() + movementState = moveState.ROLL + + +# API Interface for ai_hero +func run(direction, delta): + direction = direction.normalized() + rollvector = direction + set_animation_tree_vector() + movementState = moveState.MOVE + velocity = velocity.move_toward(player_stats.speed * rollvector, ACCELERATION * delta) + if direction == Vector2.ZERO: + animation_state.travel("idle") + else: + animation_state.travel("run") + + func movement_move(delta): var input_vector = Vector2.ZERO @@ -89,21 +139,24 @@ func movement_move(delta): velocity = Vector2.ZERO else: rollvector = input_vector - animation_state.change_state("run") - + set_animation_tree_vector() + animation_state.change_state("run") velocity = velocity.move_toward(player_stats.speed * input_vector, ACCELERATION * delta) if Input.is_action_just_pressed("roll"): movementState = moveState.ROLL elif Input.is_action_just_pressed("attack"): movementState = moveState.HIT - + + func movement_hit(): velocity = Vector2.ZERO animation_state.change_state("attack") func hit_finished(): - movementState = moveState.MOVE - + movementState = moveState.IDLE + ExecutionState = AI_MOVE + + func movement_roll(): velocity = rollvector * ROLL_SPEED animation_state.change_state("roll") @@ -116,10 +169,11 @@ func movement_roll(): func update(): owner.velocity = rollvector * ROLL_SPEED """ - + ExecutionState = EXECUTING func roll_finished(): - movementState = moveState.MOVE + movementState = moveState.IDLE + ExecutionState = AI_MOVE func _on_Hurtbox_area_entered(area): @@ -149,5 +203,13 @@ func _on_Hitbox_area_entered(area): currency += area.currency_value player_stats.health = player_stats.health+area.health_value player_stats.speed -= area.slowdown_value - - + + +func movement_run(direction, delta): + run(direction, delta) + + +func movement_idle(): + movementState = moveState.IDLE + velocity = Vector2.ZERO + animation_state.travel("idle") diff --git a/src/Player/Player.tscn b/src/Player/Player.tscn index c8f85e6..258ab70 100644 --- a/src/Player/Player.tscn +++ b/src/Player/Player.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=62 format=2] +[gd_scene load_steps=57 format=2] [ext_resource path="res://Player/Player.gd" type="Script" id=1] [ext_resource path="res://Player/player.png" type="Texture" id=2] @@ -12,6 +12,7 @@ [ext_resource path="res://Player/States/Attack.gd" type="Script" id=14] [ext_resource path="res://Player/PlayerStateMachine.gd" type="Script" id=15] [ext_resource path="res://Player/States/Roll.gd" type="Script" id=16] +[ext_resource path="res://Overlap/Kind.tscn" type="PackedScene" id=7] [sub_resource type="CapsuleShape2D" id=1] radius = 2.15976 @@ -625,8 +626,14 @@ font_data = ExtResource( 6 ) [node name="Player" type="KinematicBody2D"] script = ExtResource( 1 ) +debug = null +ROLL_SPEED = null FRICTION = 270 title_scene = "res://Menus/TitleScreen/TitleScreen.tscn" +ACCELERATION = null + +[node name="Kind" parent="." instance=ExtResource( 7 )] +kind = 1 [node name="Sprite" type="Sprite" parent="."] position = Vector2( 0.273621, 3.88423 ) @@ -688,7 +695,7 @@ shape = SubResource( 47 ) [node name="Pivot" type="Position2D" parent="."] position = Vector2( 0, -4.16248 ) -rotation = 1.5708 +rotation = 3.14159 __meta__ = { "_gizmo_extents_": 20.0 } diff --git a/src/World.tscn b/src/World.tscn index 2476275..33cf280 100644 --- a/src/World.tscn +++ b/src/World.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=21 format=2] +[gd_scene load_steps=8 format=2] [ext_resource path="res://Player/Player.tscn" type="PackedScene" id=1] [ext_resource path="res://World.gd" type="Script" id=2] @@ -7,19 +7,11 @@ [ext_resource path="res://Objects/Traps/Bear.tscn" type="PackedScene" id=5] [ext_resource path="res://Objects/Banana/Banana.tscn" type="PackedScene" id=6] [ext_resource path="res://Objects/Bonfire/Bonfire.tscn" type="PackedScene" id=7] -[ext_resource path="res://Objects/Traps/Sting.tscn" type="PackedScene" id=8] -[ext_resource path="res://Objects/Rubies/Blue.tscn" type="PackedScene" id=9] -[ext_resource path="res://Objects/Barrel/Barrel.tscn" type="PackedScene" id=10] -[ext_resource path="res://Objects/Heart/Heart.tscn" type="PackedScene" id=11] -[ext_resource path="res://Objects/Rubies/Red.tscn" type="PackedScene" id=12] -[ext_resource path="res://Objects/Rubies/Green.tscn" type="PackedScene" id=13] -[ext_resource path="res://Objects/Traps/Flame.tscn" type="PackedScene" id=14] -[ext_resource path="res://Objects/Traps/Spike.tscn" type="PackedScene" id=15] -[ext_resource path="res://Objects/Slime/Slime.tscn" type="PackedScene" id=16] [ext_resource path="res://Boss/Boss_template.tscn" type="PackedScene" id=17] [ext_resource path="res://Boss/SlimeBoss/SlimeBoss.tscn" type="PackedScene" id=18] [ext_resource path="res://Menus/DialogueBox/DialogueBox.tscn" type="PackedScene" id=19] [ext_resource path="res://Menus/DragNDrop/DragNDropUI.tscn" type="PackedScene" id=20] +[ext_resource path="res://Maps/Grid.tscn" type="PackedScene" id=21] [node name="World" type="Node2D"] script = ExtResource( 2 ) @@ -31,11 +23,11 @@ region_enabled = true region_rect = Rect2( 0, 0, 1280, 720 ) [node name="FloorTileMap" type="TileMap" parent="."] -position = Vector2( -16, 16 ) +position = Vector2( 16, 16 ) tile_set = ExtResource( 3 ) cell_size = Vector2( 32, 32 ) format = 1 -tile_data = PoolIntArray( -65537, 47, 0, -131072, 47, 1, -131071, 47, 1, -131070, 47, 1, -131069, 47, 1, -131068, 47, 1, -131067, 47, 1, -131066, 47, 1, -131065, 47, 1, -131064, 47, 1, -131063, 47, 1, -131062, 47, 1, -131061, 47, 1, -131060, 47, 1, -131059, 47, 1, -131058, 47, 1, -131057, 47, 1, -131056, 47, 2, -1, 47, 65536, -65536, 47, 65541, -65535, 47, 131073, -65534, 47, 131073, -65533, 47, 131073, -65532, 47, 131073, -65531, 47, 131073, -65530, 47, 131073, -65529, 47, 131073, -65528, 47, 131073, -65527, 47, 131073, -65526, 47, 65544, -65525, 47, 131073, -65524, 47, 131073, -65523, 47, 131073, -65522, 47, 131073, -65521, 47, 65542, -65520, 47, 65538, 65535, 47, 65536, 0, 47, 65538, 10, 47, 65539, 15, 47, 65536, 16, 47, 65538, 131071, 47, 65536, 65536, 47, 65538, 65546, 47, 65539, 65549, 47, 3, 65551, 47, 65536, 65552, 47, 65538, 196607, 47, 65536, 131072, 47, 65538, 131077, 47, 3, 131082, 47, 65539, 131085, 47, 65539, 131087, 47, 65536, 131088, 47, 65538, 262143, 47, 65536, 196608, 47, 65538, 196612, 47, 196608, 196613, 47, 262152, 196614, 47, 196610, 196618, 47, 65539, 196621, 47, 196612, 196622, 47, 196609, 196623, 47, 262150, 196624, 47, 65538, 327679, 47, 65536, 262144, 47, 65538, 262149, 47, 131075, 262154, 47, 65539, 262159, 47, 65536, 262160, 47, 65538, 393215, 47, 65536, 327680, 47, 65538, 327690, 47, 196612, 327691, 47, 196610, 327695, 47, 65536, 327696, 47, 65538, 458751, 47, 65536, 393216, 47, 65538, 393231, 47, 65536, 393232, 47, 65538, 524287, 47, 65536, 458752, 47, 131077, 458753, 47, 1, 458754, 47, 1, 458755, 47, 1, 458756, 47, 1, 458757, 47, 1, 458758, 47, 1, 458759, 47, 1, 458760, 47, 1, 458761, 47, 1, 458762, 47, 1, 458763, 47, 1, 458764, 47, 1, 458765, 47, 1, 458766, 47, 1, 458767, 47, 131078, 458768, 47, 65538, 589823, 47, 131072, 524288, 47, 131073, 524289, 47, 131073, 524290, 47, 131073, 524291, 47, 131073, 524292, 47, 131073, 524293, 47, 131073, 524294, 47, 131073, 524295, 47, 131073, 524296, 47, 131073, 524297, 47, 131073, 524298, 47, 131073, 524299, 47, 131073, 524300, 47, 131073, 524301, 47, 131073, 524302, 47, 131073, 524303, 47, 131073, 524304, 47, 131074 ) +tile_data = PoolIntArray( -1, 47, 4, -65536, 47, 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, 47, 65539, 14, 47, 65539, 131071, 47, 65539, 65545, 47, 4, 65546, 47, 196609, 65547, 47, 196610, 65550, 47, 65539, 196607, 47, 65539, 131081, 47, 65539, 131086, 47, 65539, 262143, 47, 65539, 196617, 47, 196612, 196618, 47, 196609, 196619, 47, 7, 196622, 47, 65539, 327679, 47, 65539, 262155, 47, 65539, 262158, 47, 65539, 393215, 47, 65539, 327689, 47, 196608, 327690, 47, 196609, 327691, 47, 196615, 327694, 47, 65539, 458751, 47, 65539, 393230, 47, 65539, 524287, 47, 196612, 458752, 47, 196609, 458753, 47, 196609, 458754, 47, 196609, 458755, 47, 196609, 458756, 47, 196609, 458757, 47, 196609, 458758, 47, 196609, 458759, 47, 196609, 458760, 47, 196609, 458761, 47, 196609, 458762, 47, 196609, 458763, 47, 196609, 458764, 47, 196609, 458765, 47, 196609, 458766, 47, 196615 ) __meta__ = { "_edit_group_": true, "_edit_lock_": true @@ -44,98 +36,15 @@ __meta__ = { [node name="YSort" type="YSort" parent="."] position = Vector2( 152, 120 ) -[node name="SlimeBoss" parent="YSort" instance=ExtResource( 18 )] -position = Vector2( 88, 75.4221 ) - -[node name="Boss_template" parent="YSort" instance=ExtResource( 17 )] -position = Vector2( -107.855, -54.5179 ) - -[node name="minion" parent="YSort" instance=ExtResource( 17 )] -position = Vector2( 88, 24 ) -scale = Vector2( 0.3, 0.3 ) -collision_layer = 8 - -[node name="Bear_trap" parent="YSort" instance=ExtResource( 5 )] -position = Vector2( 68.1447, -38.5179 ) - -[node name="Slime" parent="YSort" instance=ExtResource( 16 )] -position = Vector2( 68.1447, 57.4821 ) - -[node name="Flame" parent="YSort" instance=ExtResource( 14 )] -position = Vector2( 124.145, 65.4821 ) - -[node name="Spike" parent="YSort" instance=ExtResource( 15 )] -position = Vector2( 272, 88 ) - -[node name="Sting" parent="YSort" instance=ExtResource( 8 )] -position = Vector2( 132.145, 17.4821 ) - -[node name="Heart" parent="YSort" instance=ExtResource( 11 )] -position = Vector2( -43.8553, 65.4821 ) - -[node name="Blue" parent="YSort" instance=ExtResource( 9 )] -position = Vector2( -3.8553, 81.4821 ) - -[node name="Red" parent="YSort" instance=ExtResource( 12 )] -position = Vector2( -51.8553, 41.4821 ) - -[node name="Green" parent="YSort" instance=ExtResource( 13 )] -position = Vector2( -19.8553, 73.4821 ) - -[node name="Barrel" parent="YSort" instance=ExtResource( 10 )] -position = Vector2( 8.00002, -32 ) - -[node name="Barrel5" parent="YSort" instance=ExtResource( 10 )] -position = Vector2( 8.00002, -96 ) - -[node name="Barrel6" parent="YSort" instance=ExtResource( 10 )] -position = Vector2( -128, 16 ) - -[node name="Barrel7" parent="YSort" instance=ExtResource( 10 )] -position = Vector2( -56, 16 ) - -[node name="Barrel8" parent="YSort" instance=ExtResource( 10 )] -position = Vector2( -72, 16 ) - -[node name="Barrel9" parent="YSort" instance=ExtResource( 10 )] -position = Vector2( -88, 16 ) - -[node name="Barrel10" parent="YSort" instance=ExtResource( 10 )] -position = Vector2( -104, 16 ) - -[node name="Barrel11" parent="YSort" instance=ExtResource( 10 )] -position = Vector2( -120, 16 ) - -[node name="Barrel2" parent="YSort" instance=ExtResource( 10 )] -position = Vector2( 8.00002, -48 ) - -[node name="Barrel3" parent="YSort" instance=ExtResource( 10 )] -position = Vector2( 8.00002, -64 ) - -[node name="Barrel4" parent="YSort" instance=ExtResource( 10 )] -position = Vector2( 8.00002, -80 ) - -[node name="Banana" parent="YSort" instance=ExtResource( 6 )] -position = Vector2( -107.855, 73.4821 ) - [node name="Player" parent="YSort" instance=ExtResource( 1 )] -position = Vector2( 96, -69.5179 ) +position = Vector2( 176, 112 ) scale = Vector2( 2, 2 ) -debug = true -FRICTION = 200 +FRICTION = null [node name="Bonfire" parent="YSort" instance=ExtResource( 7 )] position = Vector2( 296, -16 ) -[node name="CanvasLayer" type="CanvasLayer" parent="."] +[node name="Boss_template2" parent="YSort" instance=ExtResource( 17 )] +position = Vector2( -40, 16 ) -[node name="DragNDropUI" parent="CanvasLayer" instance=ExtResource( 20 )] -ObjectParent = NodePath("../..") - -[node name="DialogueBox" parent="CanvasLayer" instance=ExtResource( 19 )] -anchor_bottom = 0.0 -margin_bottom = 31.0 - -[editable path="YSort/minion"] - -[editable path="YSort/minion/Hurtbox"] +[node name="Grid" parent="." instance=ExtResource( 18 )] diff --git a/src/project.godot b/src/project.godot index 686ef74..2004c48 100644 --- a/src/project.godot +++ b/src/project.godot @@ -20,6 +20,11 @@ _global_script_classes=[ { "path": "res://Menus/DialogueBox/DialogueBox.gd" }, { "base": "KinematicBody2D", +"class": "Hero", +"language": "GDScript", +"path": "res://Overlap/AI/AI_Hero.gd" +}, { +"base": "Hero", "class": "Player", "language": "GDScript", "path": "res://Player/Player.gd" @@ -42,6 +47,7 @@ _global_script_classes=[ { _global_script_class_icons={ "Boss": "", "DialougeBox": "", +"Hero": "", "Player": "", "SlimeBoss": "", "TitleSceenButton": "",