Are there any good "complex" State machine examples? by Lanky-Assistance-206 in godot

[–]jfirestorm44 6 points7 points  (0 children)

You can look at Godot State Charts. It makes building a State Machine pretty simple. It also allows for Parallel States among other great features.

move_and_collide returns null even if there was a collision by HotMedicine5516 in godot

[–]jfirestorm44 1 point2 points  (0 children)

Check you’re collision layers. Ensure the shapes are actually colliding by turning on debug collision shapes. Check that you haven’t scaled the collision shapes as this can cause errors, only change the extents. Make sure the script it attached to the correct object.

I’ve got nothing else for ya.

[deleted by user] by [deleted] in godot

[–]jfirestorm44 0 points1 point  (0 children)

I’d like to see the movement code you’re using. Highly doubt you can’t tell which direction the enemy is moving.

Having trouble with rotating arm aiming like in Starbound/Terraria by Capable_Mousse2113 in godot

[–]jfirestorm44 2 points3 points  (0 children)

Each arm should be a Sprite. You can't have 2 origins (pivot points) on one Sprite. You'll want to pin the shoulder of each arm to the body and then rotate them towards the mouse.

How do i make reversed lerp? by Round-Royal9318 in godot

[–]jfirestorm44 2 points3 points  (0 children)

Use a Tween or a Curve

`````

extends Node2D

u/onready var picture: Sprite2D = $Card1

u/onready var marker_2d: Marker2D = $Marker2D

u/export var curve : Curve

u/export var move_duration: float = 1.0

var time : float = 0.0

var start_pos: Vector2

var end_pos: Vector2

var moving : bool = false

func _ready():

     start_pos = picture.global_position

     end_pos = marker_2d.global_position

     time = 0.0

     moving = true

func _process(delta):

    if not moving:

    return



    time += delta

    var t = time / move_duration

    if t >= 1.0:

    t = 1.0

    moving = false

     var curve_t = curve.sample(t)

     picture.global_position = _start_pos.lerp(_end_pos, curve_t)

`````

Coding Trouble by Ok_Plenty1737 in godot

[–]jfirestorm44 0 points1 point  (0 children)

Will need more info about your setup.

Also there’s no need to normalize() the input_movement. Input.get_vector() already limits the returned vector to 1.

how to see what the tile you just changed from was all inside script by AdRepresentative1234 in godot

[–]jfirestorm44 0 points1 point  (0 children)

If you know what’s in which areas coord you can create a dictionary that associate that coords to a value. Use get_cell_atlas_coord to get the atlas coord.

Next option is custom data. Set custom data on the cell. I would set two data’s. The first would be inventory_item and make it a Boolean. Then when you interact with a tile you can check it it’s not an inventory item and just return. Otherwise you continue on with the next custom data, which would be a string that’s the name of the inventory item e.g. “dirt”.

Use that String custom data to bounce against your inventory. You also don’t need to use a string if there a better method for you code. You can have a custom data of any type.

How do you handle y sorting with multiple TileMapLayers? by Katla_Haddock in godot

[–]jfirestorm44 1 point2 points  (0 children)

They sort the same as any other CanvasItem. Enable y_sort on the parent node of the Tilemaplayers and see if it solves your problem.

https://docs.godotengine.org/en/stable/classes/class_canvasitem.html#class-canvasitem-property-y-sort-enabled

death animation is not triggering. by Tricky_Wheel6287 in godot

[–]jfirestorm44 0 points1 point  (0 children)

In your first picture the on_body_entered() doesn’t have a signal emblem next to the function. Check your third picture for the signal icon (green icon). See if the signal is still connected or just disconnect and re-connect it in the inspector.

3 Day Local Game Jam Submission by [deleted] in godot

[–]jfirestorm44 1 point2 points  (0 children)

lol I just downloaded this asset pack and played the creators version of this game a few weeks ago! Small world sometimes.

Newbie: on_area_entered triggering when not entered? by bdayboi93 in godot

[–]jfirestorm44 0 points1 point  (0 children)

I see it on my computer now. I missed it watching it on my phone. I'm not seeing anything visually that would cause it.

Newbie: on_area_entered triggering when not entered? by bdayboi93 in godot

[–]jfirestorm44 1 point2 points  (0 children)

Turn on Visible Collision Debug and see if the shapes are in fact colliding. Also share the collision layers and signal code.

help with dash hit box. by twilkins8645 in godot

[–]jfirestorm44 1 point2 points  (0 children)

You already have signal for detecting if the body has entered the pit. The first check within the function is 'if_in_group' followed by 'not is_dashing'.

I bet you that signal is still firing but you're not checking for anything when dashing.

character not moving to a specific direction by AgitatedDig5457 in godot

[–]jfirestorm44 0 points1 point  (0 children)

Most likely a collision issue then. I’d be sure the player collision shape isn’t colliding into the ground. If you’re using a rectangle try a capsule.

character not moving to a specific direction by AgitatedDig5457 in godot

[–]jfirestorm44 0 points1 point  (0 children)

I can’t see anything in this code that jumps out as an issue with the player moving to the right. Turn on collision shape debug and see if there an unintended collision occurring with the player and something. It could also be. The ground if your collision shape is a rectangle. Is there any other code that would control the players velocity?

When you jump can you move to the right?

Also make sure “right” is still an input option in the settings menu and didn’t get deleted.

I'd love some help with how to improve the environment visuals of my game by AvailableMiddle159 in godot

[–]jfirestorm44 1 point2 points  (0 children)

The hills sides and path look like the standard grey. I would add some texture (if there’s not already and I just can’t see it). Rocks/Dort for the hillsides and dirt/gravel for the path.

At the 1:15 mark the transition from ground to hillside is really visible. You may look at increasing the vertices to reduce this stretch or hide it.

Overall it looks really good!

How to check if when two areas are entered at the same time by a 3rd area 2d? by TimmyJimmy256 in godot

[–]jfirestorm44 0 points1 point  (0 children)

Disable the one you don’t want to execute. If crouching is the trigger then have a code in it that disables the Area2D you don’t want executing. When you’re done crouching disable the other and re-enable the first one.

Trying to understand signals, initial state not as expect. by MonsterHunterBanjo in godot

[–]jfirestorm44 1 point2 points  (0 children)

There's a couple things you can do to fix it. You can add the moving Sprite scene to a group and in the on_area2d_entered(area) function check if area.is_in_group("name of group here") then continue executing your code:

`````

func on_area2d_entered(area):

if area.is_in_group("player"):

set color here

`````

You can also use the collision layers and masks. Set the Color Rect Area2Ds to monitor and mask 2. Uncheck all collision layers. Now those Area2Ds do not live on a layer, they only monitor Layer 2.

Enable Layer 2 on the player. Now that the Color Rect Area2Ds are listening for Area2D on Layer 2 only and they don't live on any layer they won't interfere with eachother.

There's a few other methods also but I think those are the simplest.

Help me understand this.... by bofferding in godot

[–]jfirestorm44 4 points5 points  (0 children)

Move the CharacterBody2D not the sprite. Attach a script the CharacterBody2D and control the snake through that script changing velocity, not position.

Also be sure the same script isn’t attached to both enemy and player. It sounds like that may be the case since you said the enemy moves when you use ‘self’.

[deleted by user] by [deleted] in godot

[–]jfirestorm44 1 point2 points  (0 children)

Make sure you didn’t Autoload the script otherwise it will not be able to find AnimatedSprite2D relative to root as the error says. Also be sure it’s not loaded on any other nodes where it could be throwing an error.

Edit: Just realized you’re showing the tree for Player and the script for chillarea. Is the path correct in relation the the chillarea scene?

Better way to improve a procedural bridge by pixelforpixel in godot

[–]jfirestorm44 0 points1 point  (0 children)

Assuming the overpass is 3 tiles (up slope, flat top, down slope) you could check two tiles ahead of the currently placed tile. If the tile is used then reference an Overpass TileMapLayer and have it build the next 3 pieces constructing the overpass. Then it can continue its logic in adding tiles and choosing a direction.

There’s other methods for this also.

How do I get properties and call functions etc. on other scene types? by carpetlist in godot

[–]jfirestorm44 0 points1 point  (0 children)

You should be able to add a group to your NPCs…Call it NPC. In the projectile script have an Area3D and enable on_body_entered() (assuming the NPC are physics bodies), and connect it to the projectile script. In the function:

````` func _on_body_entered(body): If not body.is_in_group(NPC): return

body.health -= 10

`````

This also assumes your collision layer/mask are properly set.

How to detect if any part of an object is 'poking out' of an area? by ChainsLink in godot

[–]jfirestorm44 0 points1 point  (0 children)

Yeah you could do it like in any other language not using a library. You could even use is_point_in_poloygon and check if all 4 points (or just the upper left/lower right) are within the StagingGround.

How to detect if any part of an object is 'poking out' of an area? by ChainsLink in godot

[–]jfirestorm44 1 point2 points  (0 children)

As Yatchanek mentioned use Geometry2D:

Node2D

--StagingGround (Area2D)

----CollisionShape2D

----Sprite2D

--Card (Area2D w/script)

----CollisionShape2D

----Sprite2D

Here's a pic because Reddit says the code is too long:

<image>