Devlog 0


InventorySorry for being late, Anyway...
This week, I made a few tweaks and some systems for the game.

Things I made this week:

1. Entity Script [taken from an old one]
2. Player Script [Aslo Taken from the same one]
3. Inventory Designs

Entity Script

In my previous tests before this devlog, I made couple of player & Entity scripts which I also reused also in this game.

What does it consist of

It extends the built-in class KinematicBody2D and has functions like

set_velocity(velocity : Vector2)

Takes a velocity variable which then use it in the built-in move_and_slide() function

heal(value : float)

Takes a value which then add it to the health variable & then clamps the health variable to its MIN & MAX

damage(value : float)

Takes a value which then substract from the health variable & then clamps the health variable to its MIN & MAX
Also if health variable reached 0, it will emit entity_died signal with the entity path in the scene as its binds

change_min_health(value : float)

Takes a value which then sets it as min_health variable

change_max_health(value : float)

Takes a value which then sets it as max_health variable

stop_moving()

Sets the variable can_move to false

enable_moving()

Sets the variable can_move to true

_death_occured()

The function called when the entity dies

Player Script

It was intended at first for the player_movement script to extends the entity script but because The Player Object is an inherited scene, the player_movement script became alone and just a node in the Player Object which have a variable the refer to the entity script in the Player Object Node

What does it consist of

It's just like a normal script that just extends Node class and it must have some functions

Variables

there should be some variables because you would get lost without them

normal_speed : float
acceleration_speed : float
deceleration_speed : float

movement_velocity : Vector2
dir : Vector2
max_rotation : float
rotation_speed : float

_proccess()

Most code is in the _proccess function

It starts with getting the x_axis & y_axis which are just values from [-1, 1] that indicates the direction the player is moving & store them in dir,
Dir is then normalized to make sure the direction is right

If x_direction doesn't equal to 0
=> add to the movement_velocity.x the product of [acceleration_speed, x_direction, delta]
=> clamp the movement_velocity.x to (-normal_speed, normal_speed)
=> set the parent's rotation to the lerp(of: parent's rotation, to: max_rotation * x_direction, weight: delta * rotation_speed)

Else
If the x_direction is positive
=> substract from the movement_velocity.x the product of (deceleration_speed, delta)
=> clamp the movement_velocity.x to (0, normal_speed)

Else
=> adds to the movement_velocity.x the product of (deceleration_speed, delta)
=> clamp the movement_velocity.x to (-normal_speed, 0)

And it does the same for the y_axis

After that it calls the function set_velocity from its parent to apply movement_velocity

Inventory Designs

I've made couple of designs for the inventory to make sure it's suitable for the game & ended up with that in the begaining

It doesn't look cool but it should give the quite the idea of how the inventory will look

Also the action button on the back of the card is set to be the action of the cards like for food it will be 'eat' for items [equip] and so on

Leave a comment

Log in with itch.io to leave a comment.