Rewritten some recipes. Added Chilli fruit to give laser spell a recipe
parent
85e0ca75ff
commit
89f0faea9a
|
|
@ -0,0 +1,22 @@
|
|||
[gd_scene format=3 uid="uid://cchili0scene1"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/chili.gd" id="1_chili0"]
|
||||
[ext_resource type="Texture2D" uid="uid://d2pinnrigixnp" path="res://assets/16x16 Pixelart Food Icons/Pixel_Foods(ARTLİNE).png" id="2_chili0"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_chili"]
|
||||
atlas = ExtResource("2_chili0")
|
||||
region = Rect2(19, 37, 16, 16)
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_chili"]
|
||||
radius = 4.0
|
||||
height = 12.0
|
||||
|
||||
[node name="Chili" type="Area2D" unique_id=200000001]
|
||||
script = ExtResource("1_chili0")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=200000002]
|
||||
texture_filter = 1
|
||||
texture = SubResource("AtlasTexture_chili")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=200000003]
|
||||
shape = SubResource("CapsuleShape2D_chili")
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
[gd_scene format=3 uid="uid://cpe6aiuqiox0u"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dklt42vjjcks7" path="res://scripts/fire_slime.gd" id="1_88j2t"]
|
||||
[ext_resource type="Script" uid="uid://cjkaw7wqw4e30" path="res://scripts/drop_table.gd" id="dt_fslime"]
|
||||
[ext_resource type="PackedScene" uid="uid://cchili0scene1" path="res://scenes/chili.tscn" id="chili_fslime"]
|
||||
[ext_resource type="Texture2D" uid="uid://b1tyfy8ooudkc" path="res://assets/Slime3/With_shadow/Slime3_Death_with_shadow.png" id="2_ahfdi"]
|
||||
[ext_resource type="Texture2D" uid="uid://bbm1sv6hmc2j" path="res://assets/Slime3/With_shadow/Slime3_Hurt_with_shadow.png" id="3_kq38e"]
|
||||
[ext_resource type="Texture2D" uid="uid://bt07131sttb6e" path="res://assets/Slime3/With_shadow/Slime3_Walk_with_shadow.png" id="4_ret1g"]
|
||||
|
|
@ -732,9 +734,15 @@ radius = 7.071068
|
|||
[sub_resource type="CircleShape2D" id="CircleShape2D_odbmi"]
|
||||
radius = 8.062258
|
||||
|
||||
[sub_resource type="Resource" id="Resource_chili_drop"]
|
||||
script = ExtResource("dt_fslime")
|
||||
drop = ExtResource("chili_fslime")
|
||||
chance = 0.4
|
||||
|
||||
[node name="FireSlime" type="CharacterBody2D" unique_id=1827403107]
|
||||
script = ExtResource("1_88j2t")
|
||||
metadata/_custom_type_script = "uid://c0uv02nt5ocvg"
|
||||
drop_table = Array[ExtResource("dt_fslime")]([SubResource("Resource_chili_drop")])
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." unique_id=1151813585]
|
||||
texture_filter = 1
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ extends Node
|
|||
|
||||
const APPLE = 0
|
||||
const GRAPE = 1
|
||||
const CHILI = 2
|
||||
|
||||
const NONE = "NONE"
|
||||
const SHURIKEN = "SHURIKEN"
|
||||
|
|
@ -10,23 +11,22 @@ const FIRE_SWIRL = "FIRE_SWIRL"
|
|||
const TORNADO = "TORNADO"
|
||||
const LASER = "LASER"
|
||||
|
||||
# Each spell's display recipe: sorted apples-first, grapes-last
|
||||
var recipes: Dictionary = {
|
||||
SHURIKEN: [APPLE, GRAPE, GRAPE],
|
||||
FIREBALL: [APPLE, APPLE, APPLE],
|
||||
FIRE_SWIRL: [APPLE, APPLE, GRAPE],
|
||||
TORNADO: [GRAPE, GRAPE, GRAPE],
|
||||
LASER: [],
|
||||
FIREBALL: [APPLE],
|
||||
TORNADO: [GRAPE],
|
||||
LASER: [CHILI],
|
||||
SHURIKEN: [APPLE, GRAPE],
|
||||
FIRE_SWIRL: [APPLE, CHILI],
|
||||
}
|
||||
|
||||
# Takes cauldron slot_states (uses texture indices: 2 = apple, 4 = grape)
|
||||
# and returns which spell that combination brews.
|
||||
func identify(cauldron_slots: Array) -> String:
|
||||
var apples = cauldron_slots.count(2)
|
||||
var grapes = cauldron_slots.count(4)
|
||||
var types: Array = []
|
||||
if cauldron_slots.any(func(x): return x == 2): types.append(APPLE)
|
||||
if cauldron_slots.any(func(x): return x == 4): types.append(GRAPE)
|
||||
if cauldron_slots.any(func(x): return x == 3): types.append(CHILI)
|
||||
|
||||
for spell_id in recipes:
|
||||
var r: Array = recipes[spell_id]
|
||||
if r.count(APPLE) == apples and r.count(GRAPE) == grapes:
|
||||
if recipes[spell_id] == types:
|
||||
return spell_id
|
||||
return NONE
|
||||
|
||||
|
|
|
|||
|
|
@ -87,6 +87,8 @@ func progres_bar(fruit):
|
|||
change_texture(progres_index, 2)
|
||||
if fruit is Grape:
|
||||
change_texture(progres_index, 4)
|
||||
if fruit is Chili:
|
||||
change_texture(progres_index, 3)
|
||||
_pop_slot(progres_index)
|
||||
progres_index += 1
|
||||
if progres_index == 3:
|
||||
|
|
@ -117,6 +119,7 @@ func brew(fruits):
|
|||
SpellLibrary.FIREBALL: witch.shoot_fireballs()
|
||||
SpellLibrary.FIRE_SWIRL: witch.shoot_fire_swirl()
|
||||
SpellLibrary.TORNADO: witch.shoot_tornado()
|
||||
SpellLibrary.LASER: witch.shoot_laser()
|
||||
reset_texture()
|
||||
is_brewing = false
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
extends DropsBase
|
||||
class_name Chili
|
||||
|
|
@ -0,0 +1 @@
|
|||
uid://dinqfnri3co88
|
||||
Loading…
Reference in New Issue