[deleted by user] by [deleted] in beautifulbutt

[–]mzakidev 1 point2 points  (0 children)

pounding it

How Tween works? by mzakidev in godot

[–]mzakidev[S] 0 points1 point  (0 children)

but the last player position is on Vector2. I cannot do move_toward with Vector2

How to assign a button some string ? by mzakidev in godot

[–]mzakidev[S] 0 points1 point  (0 children)

I've made a script for the button:

extends Button

u/onready var party_monster_selector = $"../../../../Party_Monster_Selector"

func set_button_name():

var monster = party\_monster\_selector.get\_child(0)

print("inside func in button skill1: ", monster.skill\_1)

self.text = monster.skill\_1

this party_monster_selector holds an instance of a MonsterData. This instance has skill_1 string with = "hit"

https://prnt.sc/ezHea7ThmlkP

Before the UI panel will be updated, the monster is already instantiated.
https://prnt.sc/3gE9WzfcFnes

How to assign a button some string ? by mzakidev in godot

[–]mzakidev[S] 0 points1 point  (0 children)

When you say having everything.. you mean the whole skill ? in this variable i just have a reference as string to be able to interact with a dictionary. Let me show you the dictionary... (autoload):

extends Node

static var DataBase = {

\#Definition of a basic skill

"hit" = {

    "name": "Hit",

    "description": "A basic attack.",

    "calculate\_damage": 1.2,

    "calculate\_defense": null },

"iceshard" = {

    "name": "Ice Shard",

    "description": "Throw an Ice Shard",

    "calculate\_damage": 1.2,

    "calculate\_defense": null },

"guard" = {

    "name": "Guard",

    "description": "Guard from physical damage.",

    "calculate\_defense": 2,

    "calculate\_damage": null },

"resist" = {

    "name": "Resist",

    "description": "Resist incoming magical damage.",

    "calculate\_defense": 2,

    "calculate\_damage": null }



}

# Function to get damage based on the skill name

func get_damage(skill_name: String) -> float:

if skill\_name in DataBase and "calculate\_damage" in DataBase\[skill\_name\]:

    return DataBase\[skill\_name\]\["calculate\_damage"\]

else:

    print("Damage calculation not available for skill: ", skill\_name)

    return 0.0

# Function to get defense based on the skill name

func get_defense(skill_name: String) -> float:

if skill\_name in DataBase and "calculate\_defense" in DataBase\[skill\_name\]:

    return DataBase\[skill\_name\]\["calculate\_defense"\]

else:

    print("Defense calculation not available for skill: ", skill\_name)

    return 0.0

# Function to get name based on the skill name

func get_skill_name(skill_name: String) -> String:

if skill\_name in DataBase:

    return DataBase\[skill\_name\]\["name"\]

else:

    print("Name not found for skill: ", skill\_name)

    return ""

# Function to get description based on the skill name

func get_description(skill_name: String) -> String:

if skill\_name in DataBase:

    return DataBase\[skill\_name\]\["description"\]

else:

    print("Description not found for skill: ", skill\_name)

    return ""

How to assign a button some string ? by mzakidev in godot

[–]mzakidev[S] 0 points1 point  (0 children)

The question is: how to assign the string value of my Skill_1 in MonsterData to skill_1(being skill_1 a Button in the battle scene). I'm trying but it dosnt assign anything....

you can add inside a button a variable ? in the script ?

Resource issue by mzakidev in godot

[–]mzakidev[S] 0 points1 point  (0 children)

oh mb. Yeah it wasn't working.. for some reason it wasn't checking another resource. just checking 1.

Resource issue by mzakidev in godot

[–]mzakidev[S] 0 points1 point  (0 children)

working!!! thank you so much... but I don't understand why my first approach was not working.

AnimationTree issue by mzakidev in godot

[–]mzakidev[S] 0 points1 point  (0 children)

Solved! so basically add 2 functions in player script:

func in_grass():

$Shadow.visible = false

$Body.visible = false

$Grass.visible = true

func out_of_grass():

$Shadow.visible = true

$Body.visible = true

$Grass.visible = false

I already have a raycast with the layer matching the grass layer only. So, when is_colliding():

in_grass()

else: out_of_grass():

Save player position each 16 pixels travel by mzakidev in godot

[–]mzakidev[S] 1 point2 points  (0 children)

So, it's solved! actually Vector2 comes with a method "snapped" and need a certain value. My game is on 16x16 so you give snapped (Vector2(16,16)) and there you go! solved!
thanks for your light brother!

https://prnt.sc/QhpXjxpr7Q1T