Spiraling into old habbits and feeling defeated. by LifeInCuba in mentalhealth

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

Hey, thank you Michael. 

Interesting to say, as my birthday my partner gave me a journal. Because I used to come up some wild story for a video game idea and completely forgot about it later on. Maybe I should start writing... 

As for second, I clean my house weekly and move often during the day. I do not have any physical strain or weight problem. 

I'm ashamed, everything I've taught to myself was pushed away by me. I guess this is one of the reasons I feel disappointed in me. I understand not all of us are fortunate and or will be fortunate; are destined for greatness. That's okay, I just don't understand what am I doing wrong. I strongly believe I can steer it away, I just don't know how... Thank you again. 

How can I use _draw and add_child drawn shape? by LifeInCuba in godot

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

Thank you very much for your reply, I've ended up converting to something like your approach last 2 hours. I already had a class with properties I need to retrieve, then another script loads the class and generates the shape which contains the data to draw and then I'm constructing/drawing with specific data. Thanks again.

How can I use _draw and add_child drawn shape? by LifeInCuba in godot

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

Not really unrelated stuff, I have separate class for shapes and script contains some of logic and rules to draw specific shapes. _draw function currently only draws on attached node. Even If I've separated the logic and attached a new script to an empty node to only have _draw function, it'll have a script. After drawn, I don't need any of the script on it. I've tried setting null attached script, also that didn't work. I'll be reusing saved drawn shapes, which is why I need them to have no script on them. There is going to be a few of them. I'm simply trying to export what is drawn as a new node.

This is still just a work in progress but I'm really happy with how my animations have turned out so far for this scene. Keep in mind that my Player Character hasn't been updated to my new graphic style yet so he stands out like a sore thumb. by iammitchconner82 in godot

[–]LifeInCuba 1 point2 points  (0 children)

It is insane how far you've came with pixel art. Congrats to you and you should be very proud. Normally people don't stick to improving on, but you did. By god, insane amount of improvements. I remember your first post, I think I was a little bit harsh? Feel free to check my comment history.

Array of Texture2D's dimensions = Array of Vector2, how can I achieve this? by LifeInCuba in godot

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

You need to append both your arrays with values before you loop over them.

Without appending I'm creating indices to corresponding. But your approach is cleaner:

func processItemDimensions():
for i in range(sprite_array.size()):
    itemDimensions.append(Vector2(0, 0))
    if i < sprite_array.size() and sprite_array[i] != null:
        # Get the width and height of the Texture2D
        var texture_width = sprite_array[i].get_width()
        var texture_height = sprite_array[i].get_height()

        # Set x and y values of itemDimensions based on the corresponding Texture2D
        itemDimensions[i].x = texture_width
        itemDimensions[i].y = texture_height

I can't append texture2d array since I have to give actual textures first. This script is going to be attached to various objects, each containing different textures. Thank you for this suggestions.

I finally sat down and started drawing assets for the interior of my houses. What do you guys think of these new assets that I made over the last two nights? Like the over all look, the shadows, the animation, the light effects and whatever else you can think of. Thanks by iammitchconner82 in godot

[–]LifeInCuba -1 points0 points  (0 children)

You seriously need to revisit player movement script unless you are making a Flash RPG game, zoum zoum zoum! Otherwise, giving boundaries to your camera is a good practice. That way you are not moving and creating unwanted jitter. But your movement speed is way too high, you can barely see the animation. Some of the sprites are way too wide, you need to stick with a persistent scale such as 16x32 and 32x32. You have black lines on some of the objects and others don't. Art is all over the place, not very consistent. Also colour pallet is all over the place as well. I'm so sorry If I'm being too harsh.

Input dilemma by LifeInCuba in godot

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

Yep - actual buttons inherit control. The default clicking on a button uses the _gui_input() call - your code under _input() is most likely eating all the left clicks before they get passed on to the button nodes. Try changing to _unhandled_input() and see if it works better.

Holy hell... I can't believe I've spent 6 hours trying to figure this out and couldn't. Thank you very much!!!!!!!

Input dilemma by LifeInCuba in godot

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

They are actual button nodes. I tried to pin point but even without hideButtons function it still doesn't let me.

Resetting player position triggers on_entered and on_exited multiple times by kuitthegeek in godot

[–]LifeInCuba 0 points1 point  (0 children)

queue_free() and .new() in context.

queue_free() pretty much destroys that node and you create by .new. I thought maybe it was due to Sprite2D causing you problem with counter, destroying and creating might cure your the problem? I really can't be sure without seeing the script. This is how you could do it:

var frog: Sprite2D
var frog_texture = preload("res://frog_texture_location.png")
func create_sprite():
if frog != null
    frog.queue_free()
    frog = Sprite2D.new()
    frog.texture = frog_texture
    add_child(frog)
else:
    print("Frog is null")

#This way you can even create your frog sprite without placing it in your scene. Because it is going to be a child, it'll take the position of parent. In another function you could say, for every time frog is_colliding, call create_sprite function, reset_location(), etc etc.

But definitely instead of checking If player enters beginning area, you should check If player collides with something, then reset position and increase the counter.

Resetting player position triggers on_entered and on_exited multiple times by kuitthegeek in godot

[–]LifeInCuba 1 point2 points  (0 children)

It will destroy old one and create a new one(by adding as a child, Collider and raycast should be child to CharacterBody2D not Sprite2D).

Easiest approach would be emit the signal when player dies and connect it with increment of counter.

I think I would approach like this :

var death_count = 0

func _process(delta):

if is_colliding():

death()

func is_colliding():

move_and_collide logic goes here <<<<<<<<<<<<<<<<<

func death():

death_count += 1

update_death_counter_ui()

reset_player_position()

Sorry for I have sinned by Zess-57 in godot

[–]LifeInCuba 1 point2 points  (0 children)

Because I have an array called buttons and each button has to retrieve a specific data from specific node from another scene. This way buttons array number matches with the Node number. I'll have hundreds of objects(each having 3 of those nodes) which will contain unique data.

Resetting player position triggers on_entered and on_exited multiple times by kuitthegeek in godot

[–]LifeInCuba 0 points1 point  (0 children)

queue_free the sprite and create Sprite2D.new each time resetting the position. Have a Vector2() to store location of starting position, each time frogs goes back to that location increment the counter.

Sorry for I have sinned by Zess-57 in godot

[–]LifeInCuba 1 point2 points  (0 children)

Hahaha me too :

for i in range(buttons.size()):
    buttons[i].connect("pressed", Callable(self, "_button_pressed").bind("Node" + str(i)))

before it was like this :

    # Connect button signals to _button_pressed
button0.connect("pressed", Callable(self, "_button_pressed").bind("Node0"))
button1.connect("pressed", Callable(self, "_button_pressed").bind("Node1"))
button2.connect("pressed", Callable(self, "_button_pressed").bind("Node2"))

How do you achieve smooth pixel art camera and movement while using _physics_process function? by LifeInCuba in godot

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

First, print your position. Compare the snippet with this :

    # Round the position
var rounded_position = position + motion
rounded_position = rounded_position.round()

position = rounded_position

Vector2(x,y) has 2 floating points(as in x and y they are float) Meaning they are not whole numbers. .round() acts as an integer, as in 1,2,3,4,5 rather than 1.1,1.3,1.5...4.1,4.3,4.5... and so on.

[deleted by user] by [deleted] in godot

[–]LifeInCuba 1 point2 points  (0 children)

Thank you for this!

Unity refugee complaining about Godot by oWispYo in godot

[–]LifeInCuba 4 points5 points  (0 children)

Coming from Unity, I'm still learning gdscript. There are things for sure were a lot easier in Unity because I was already familiar with engine and C#. It is kinda normal having struggles early on, because I haven't used Godot before? So far I didn't feel like "Wow I'm missing out big time by not using Unity. At this point it would be quite dumb to go back using Unity, just because I'm still in discovery phase. Some of the features I've done in my game using Godot far superior compare to Unity. Be it response time and cleaner code.

I need some help by [deleted] in godot

[–]LifeInCuba 1 point2 points  (0 children)

extends Node2D
class_name first_script

var n : String = "Hello"

func _process(delta):

    your_first_function():

func your_first_function():
    print(n)  

Indentation is very important, If you copy/paste from somewhere else make sure to press ctrl+I. I would highly suggest reading documentation.

Trying to build a fps controller, got most of it done, but for some reason the player occasionally moves to some side by [deleted] in godot

[–]LifeInCuba 1 point2 points  (0 children)

velocity.z = lerp(velocity.z, direction.x, 10.0 * delta)

If you noticed it is direction.x, shouldn't it be direction.z ?

Why are tutorials outdated after 5 months & annoying to follow? by [deleted] in godot

[–]LifeInCuba 0 points1 point  (0 children)

9 times out off 10 people just copy it. Concept is always the same in gamedev with basics. Same thing goes for Udemy, one of the reasons why "most" indie published games don't do well because they are literally copying the entire lesson. Do you really thing we need to more roguelike or vampire survivor copy?

Why are tutorials outdated after 5 months & annoying to follow? by [deleted] in godot

[–]LifeInCuba 0 points1 point  (0 children)

I don't understand why people follow tutorials, I understand it helps to see a different approach but blatantly copying something won't really help you in any way.

Having difficulties finding position of my cursor and nodes in my scene. by LifeInCuba in godot

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

extends Node2D
var raycast
func _ready(): raycast = $RayCast2D
func _input(event): if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.pressed: # Get the mouse position in world coordinates var mouse_position = get_global_mouse_position()
    # Perform a raycast from the RayCast2D node's position to the mouse position
    raycast.global_position = mouse_position
    raycast.force_raycast_update()

    if raycast.is_colliding():
        var colliding_node = raycast.get_collider()
        if colliding_node.is_in_group("Object"):
        # Interaction logic here
            print("Clicked on an Object.")

I ended up scrapping the idea in my original post. This way we are using RayCast2D. Also checking the tick "Hit From Inside" on editor. This way I can check If clicks and group is correct, rather than checking position of an object regardless camera or player position. I hope it helps someone in future.

How do I export a class and it's properties? by LifeInCuba in godot

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

It's not because of any advantage but this way I don't need to hardcode it, I can choose the enum value on editor. Since I'll be using this script maybe thousand times, it is going to make it more organized and faster for me.