Skip to content

Commit

Permalink
Merge pull request #96 from skni-kod/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Kacperacy authored Mar 23, 2021
2 parents baffd68 + bd6c181 commit 8bd8b1a
Show file tree
Hide file tree
Showing 37 changed files with 420 additions and 174 deletions.
38 changes: 19 additions & 19 deletions Jsons/ItemStats.json
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
{
"Weapons": {
"Blade": {
"attack": "10",
"spd": "0.5",
"knc": "0.2",
"attack": "7.5",
"spd": "1",
"knc": "0",
"range": "melee",
"effect": "none"
},
"Axe": {
"attack": "5",
"attack": "10",
"spd": "0.5",
"knc": "0.3",
"knc": "0",
"range": "melee",
"effect": "none"
},
"Katana": {
"attack": "25",
"spd": "0.3",
"spd": "0.4",
"knc": "0",
"range": "melee",
"effect": "none"
},
"Knife": {
"attack": "3",
"spd": "1",
"knc": "0.1",
"spd": "1.5",
"knc": "0",
"range": "melee",
"effect": "none"
},
"Hammer": {
"attack": "3",
"spd": "1",
"knc": "0.1",
"attack": "30",
"spd": "0.3",
"knc": "0",
"range": "melee",
"effect": "none"
},
"Spear": {
"attack": "3",
"spd": "1",
"knc": "0.1",
"attack": "15",
"spd": "0.75",
"knc": "0",
"range": "melee",
"effect": "none"
},
Expand All @@ -50,17 +50,17 @@
"effect": "none"
},
"BloodSword": {
"attack": "10",
"spd": "0.5",
"knc": "0.2",
"attack": "20",
"spd": "0.6",
"knc": "0",
"range": "melee",
"effect": "none"
}
,
"FMS": {
"attack": "10",
"attack": "22",
"spd": "0.5",
"knc": "0.2",
"knc": "0",
"range": "melee",
"effect": "none"
}
Expand Down
42 changes: 33 additions & 9 deletions Random_gen.gd
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ var n = 0
var szer = 512
var dl = 288
var gen = 0
var oneDoor = 0
var drawn = false
var scene = load("res://Scenes/Levels/Room.tscn")
var player = load("res://Scenes/Actors/Player.tscn")

func draw(map):
var oneDoorRooms = []
Expand Down Expand Up @@ -73,15 +76,35 @@ func generate():
if queue:
position = queue.pop_front()
else:
for room in rooms:
room.queue_free()
rooms = []
map = []
queue = []
position = Vector2.ZERO
n = 0
generate()
draw(map)
map = []
queue = []
position = Vector2.ZERO
n = 0
generate()
oneDoor = 0
for room in map:
if not room == Vector2.ZERO:
var doors = 0
if not room + Vector2.DOWN in map:
doors += 1
if not room + Vector2.UP in map:
doors += 1
if not room + Vector2.RIGHT in map:
doors += 1
if not room + Vector2.LEFT in map:
doors += 1
if doors == 3:
oneDoor += 1
if oneDoor > 0 and not drawn:
draw(map)
drawn = true
elif not drawn:
map = []
queue = []
position = Vector2.ZERO
n = 0
oneDoor = 0
generate()

func step(direction):
var target_position = position + direction
Expand All @@ -92,6 +115,7 @@ func step(direction):
n -= 1

func _ready():
MusicController.stop_music()
generate()

#func _physics_process(delta):
Expand Down
33 changes: 31 additions & 2 deletions Scenes/Actors/Big Devil.gd
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ var randomPosition
var hit_pos
var target
var laser_color = Color(1.0, 0, 0, 0.1)
var level

func _ready():
health_bar.on_health_updated(health) # wczytuję życie do paska życia
$Laser_Load.emit = false
level = get_tree().get_root().find_node("Main", true, false)

func _physics_process(delta):
move = Vector2.ZERO
Expand Down Expand Up @@ -124,9 +126,9 @@ func get_dmg(dmg):
$CollisionShape2D.set_deferred("disabled",true)
$AnimationPlayer.play("Die")
yield($AnimationPlayer,"animation_finished")
var level = get_tree().get_root().find_node("Main", true, false)
rng.randomize()
var coins = rng.randf_range(drop['minCoins'], drop["maxCoins"])
random_potion()
for i in range(0,coins):
randomPosition = Vector2(rng.randf_range(self.global_position.x-10,self.global_position.x+10),rng.randf_range(self.global_position.y-10,self.global_position.y+10))
var coin = load("res://Scenes/Loot/GoldCoin.tscn")
Expand All @@ -139,7 +141,34 @@ func get_dmg(dmg):
var text = floating_dmg.instance()
text.amount = dmg
text.type = "Damage"
add_child(text)
add_child(text)

func random_potion():
rng.randomize()
var potion = int(rng.randf_range(0,3))
print(potion)
var tmp

if potion == 0:
tmp = load("res://Scenes/Loot/20healthPotion.tscn")
tmp = tmp.instance()
tmp.position = global_position
level.add_child(tmp)
elif potion == 1:
tmp = load("res://Scenes/Loot/50%Potion.tscn")
tmp = tmp.instance()
tmp.position = global_position
level.add_child(tmp)
elif potion == 2:
tmp = load("res://Scenes/Loot/60healthPotion.tscn")
tmp = tmp.instance()
tmp.position = global_position
level.add_child(tmp)
elif potion == 3:
tmp = load("res://Scenes/Loot/100%Potion.tscn")
tmp = tmp.instance()
tmp.position = global_position
level.add_child(tmp)



4 changes: 2 additions & 2 deletions Scenes/Actors/CucksBullet.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ extends KinematicBody2D
var move = Vector2.ZERO
var look_vec = Vector2.ZERO #kierunek pocisku
var player = null
var speed = 3 #predkosc pocisku
var dps = 20 #zadawany damage przez pocisk
var speed = 2 #predkosc pocisku
var dps = 5 #zadawany damage przez pocisk
onready var statusEffect = get_node("../UI/StatusBar")


Expand Down
3 changes: 1 addition & 2 deletions Scenes/Actors/CucksBullet.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ extents = Vector2( 7.56197, 8.01626 )

[node name="CucksBullet" type="KinematicBody2D"]
position = Vector2( 0, 0.46875 )
scale = Vector2( 1.25, 1.25 )
collision_layer = 12
collision_mask = 2147483651
script = ExtResource( 2 )

[node name="CollisionShape2D2" type="CollisionShape2D" parent="."]
visible = false
position = Vector2( 0.469278, -0.046293 )
scale = Vector2( 0.5, 0.5 )
shape = SubResource( 1 )
Expand All @@ -23,7 +23,6 @@ scale = Vector2( 0.5, 0.5 )
texture = ExtResource( 1 )

[node name="Area2D" type="Area2D" parent="."]
visible = false
collision_layer = 4
collision_mask = 2147483651

Expand Down
2 changes: 2 additions & 0 deletions Scenes/Actors/Little_Goblin.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,15 @@ shape = SubResource( 1 )

[node name="wzrok" type="Area2D" parent="."]
position = Vector2( 0.148651, 0 )
collision_layer = 4

[node name="CollisionShape2D" type="CollisionShape2D" parent="wzrok"]
position = Vector2( -0.604392, 1.46573 )
shape = SubResource( 2 )

[node name="Atak" type="Area2D" parent="."]
position = Vector2( 1.00227, 3.45223 )
collision_layer = 4

[node name="CollisionShape2D" type="CollisionShape2D" parent="Atak"]
position = Vector2( 0.263953, -0.852127 )
Expand Down
12 changes: 5 additions & 7 deletions Scenes/Actors/Player.gd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ onready var statusEffect = get_node("../UI/StatusBar")

var velocity = Vector2.ZERO #wektor prędkości bohatera
var got_hitted = false #czy bohater jest aktualnie uderzany
export var speed = 2 #wartośc szybkości bohatera
export var speed = 100 #wartośc szybkości bohatera
var direction = Vector2() #wektor kierunku bohatera
export var health = 100 #ilośc punktów życia bohatera
var base_health = 100 # bazowa ilość życia gracza
Expand All @@ -22,7 +22,7 @@ var level #przypisanie sceny głównej
var all_weapons = {} #wszystkie bronki
var weapons = {} #posiadane bronki
var current_weapon
var first_weapon_stats = {"attack":float(20)}
var first_weapon_stats = {"attack":float(7.5)}
var second_weapon_stats = {}

onready var ui_access_wslot1 = get_node("../UI/Slots/Background/Weaponslot1/weaponsprite1")
Expand Down Expand Up @@ -67,17 +67,15 @@ func UpdatePotions(): #funkcja aktualizująca status potek
ui_access_pslot2.texture = null
potion2_amount.text = ""
potions[2] = "Empty"





func _ready(): #po inicjacji bohatera
level = get_tree().get_root().find_node("Main", true, false) #pobranie głównej sceny
emit_signal("health_updated", health) #emitowanie sygnału o zmianie życia bohatera 100%/100%
level.get_node("UI/Coins").text = "Coins:"+str(coins) #aktualizacja napisu z ilością coinsów bohatera

#Rozwiązanie tymczasowe związane z wyświetlaniem aktualnej broni gracza
$EquippedWeapon.set_script(load("res://Scenes/Equipment/Weapons/Melee/Blade.gd"))
$EquippedWeapon.set_script(load("res://Scenes/Equipment/Weapons/Melee/Blade.gd")) # Wczytanie danej broni na starcie
$EquippedWeapon.damage = first_weapon_stats["attack"]
$EquippedWeapon.timer = $EquippedWeapon/Timer

Expand Down Expand Up @@ -301,7 +299,7 @@ func movement(): #funkcja poruszania się
Input.get_action_strength("move_down") - Input.get_action_strength("move_up")
).normalized() # Określenie kierunku poruszania się
velocity = direction * speed * statusEffect.speedMultiplier #pomnożenie wektora kierunku z wartością szybkości daje prędkość
velocity = move_and_collide(velocity) #wywołanie poruszania się
velocity = move_and_slide(velocity, Vector2.UP) #wywołanie poruszania się
if !got_hitted: #jeżeli nie jest uderzany
if direction == Vector2.ZERO: #jeżeli stoi w miejscu
$AnimationPlayer.play("Idle") #włącz animację "Idle"
Expand Down
7 changes: 6 additions & 1 deletion Scenes/Actors/Player.tscn
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[gd_scene load_steps=26 format=2]
[gd_scene load_steps=27 format=2]

[ext_resource path="res://Assets/Hero/RedHero.png" type="Texture" id=1]
[ext_resource path="res://Scenes/Actors/Player.gd" type="Script" id=2]
[ext_resource path="res://Scenes/Equipment/Weapons/EquippedWeapon.tscn" type="PackedScene" id=3]
[ext_resource path="res://Camera.gd" type="Script" id=4]
[ext_resource path="res://Scenes/title_screen/music/projekt_8bit.ogg" type="AudioStream" id=5]

[sub_resource type="Gradient" id=1]
offsets = PoolRealArray( 0, 0.794702, 1 )
Expand Down Expand Up @@ -170,6 +171,10 @@ current = true
zoom = Vector2( 0.2, 0.2 )
script = ExtResource( 4 )

[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="Camera2D"]
stream = ExtResource( 5 )
autoplay = true

[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
anims/Hit = SubResource( 11 )
anims/Idle = SubResource( 12 )
Expand Down
9 changes: 6 additions & 3 deletions Scenes/Actors/Potato.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ extends KinematicBody2D

signal died(body)

onready var statusEffect = get_node("../../../UI/StatusBar")

var player = null
var move = Vector2.ZERO
export var speed = 0.5
export var dps = 5
export var speed = 2
export var dps = 20
var right = 1
var attack = false
var max_hp = 20
var max_hp = 9
var hp:float = max_hp

export var health = 100
Expand Down Expand Up @@ -60,6 +62,7 @@ func _on_Atak_body_exited(body):
func _on_Timer_timeout():
if attack and health>0:
$AnimationPlayer.play("Attack")
statusEffect.poison = true
player.take_dmg(dps)
yield($AnimationPlayer,"animation_finished")

Expand Down
3 changes: 3 additions & 0 deletions Scenes/Actors/Potato.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ position = Vector2( 0, 0.00473362 )
shape = SubResource( 1 )

[node name="Wzrok" type="Area2D" parent="."]
visible = false
collision_layer = 0

[node name="CollisionShape2D" type="CollisionShape2D" parent="Wzrok"]
Expand All @@ -132,6 +133,7 @@ scale = Vector2( 3, 3 )
shape = SubResource( 2 )

[node name="Atak" type="Area2D" parent="."]
visible = false

[node name="CollisionShape2D" type="CollisionShape2D" parent="Atak"]
scale = Vector2( 1.25, 1.25 )
Expand All @@ -145,6 +147,7 @@ anims/Idle = SubResource( 7 )
anims/Walk = SubResource( 8 )

[node name="Timer" type="Timer" parent="."]
wait_time = 1.25
autostart = true
[connection signal="body_entered" from="Wzrok" to="." method="_on_Wzrok_body_entered"]
[connection signal="body_exited" from="Wzrok" to="." method="_on_Wzrok_body_exited"]
Expand Down
2 changes: 2 additions & 0 deletions Scenes/Actors/Slime.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,14 @@ rotation = 1.5708
shape = SubResource( 1 )

[node name="Wzrok" type="Area2D" parent="."]
collision_layer = 4

[node name="CollisionShape2D" type="CollisionShape2D" parent="Wzrok"]
position = Vector2( -0.117981, 4.09191 )
shape = SubResource( 2 )

[node name="Atak" type="Area2D" parent="."]
collision_layer = 4

[node name="CollisionShape2D" type="CollisionShape2D" parent="Atak"]
position = Vector2( 0.166862, 3.83767 )
Expand Down
Loading

0 comments on commit 8bd8b1a

Please sign in to comment.