Isaac

  • I built a system that may be similar to what you need. Basically, all items that can be "dragged and dropped" have an invisible Button node, and when that button is held down the item follows the mouse movement.

    • I'm working on a 2d shooter game and I'm trying to build an aim assist system like in the video below:

      I'm not exactly sure how to go about building this system, and I'm having trouble with comparing the angles in particular. Any help is appreciated!

    • I really want to use this addon, but I can't figure out how. There's no tutorials anywhere and the documentation doesn't provide a complete explanation of how to use it.

      Has anyone used this addon before? If so, how did you learn how to use it?


      • A mockup of what Elden Ring might look like in 2d. Made in Godot as a means of practicing making game art. The art style used is heavily inspired by Don't Starve, as I find this style fun and easy to work in. In hindsight, I could have done more to make the scene feel more "alive," such as making the plants separate textures and animating them to blow in the wind.

      • This is a clone of My Singing Monsters that I'm working on as a proof of concept of sorts as to how such a clone would work behind the scenes. Currently you can only click on and move objects, though the plan is to have something closer to the My Singing Monsters game you can play today.

        The next step is to implement a music system that will make monsters play certain tracks at certain times, though I'm unsure of how to implement such a system. Any ideas are welcome!

      • xyz To have smoother camera movements. Also for panning to work correctly, you must use a separate variable.

        • xyz replied to this.
        • xyz When Camera2d's built-in limits are enabled, the camera will indeed stop at the limits. However, if using WASD or panning at the limits as if to "move past" the limits, the camera will get stuck and will need to be "moved back," as if it were indeed moved past the limits. I believe I know why this happens: WASD and panning are tied to the "moveTarget" variable (which the "position" variable follows) rather than "position," so while the position is clamped inside the limits, the moveTarget is not. I'm unsure however of how to go about clamping the moveTarget variable, or if that is even the right approach.

          • xyz replied to this.
          • I followed this tutorial to make a camera I can control with WASD or by dragging the mouse. Here is the code:

            `extends Camera2D

            @export var zoomSpeed : float = 9
            @export var zoomLimit: float = 4
            var zoomTarget: Vector2 = Vector2.ZERO
            var moveTarget: Vector2 = Vector2.ZERO

            var dragStartMousePos: Vector2 = Vector2.ZERO
            var dragStartCameraPos: Vector2 = Vector2.ZERO
            var isDragging: bool = false

            func _ready():
            zoomTarget = zoom
            moveTarget = position

            func _process(delta):
            Zoom(delta)
            SimplePan(delta)
            ClickAndDrag()

            func Zoom(delta):
            var zoom_min: Vector2 = Vector2(zoomLimit, zoomLimit)
            var zoom_max: Vector2 = Vector2(5.0, 5.0)
            if Input.is_action_just_pressed("camera_zoom_in"):
            zoomTarget *= 1.1
            elif Input.is_action_just_pressed("camera_zoom_out"):
            zoomTarget *= 0.9

            zoomTarget = clamp(zoomTarget, zoom_min, zoom_max)
            zoom = zoom.slerp(zoomTarget, zoomSpeed * delta)

            func SimplePan(delta):
            var moveAmount = Vector2.ZERO
            moveAmount = Input.get_vector("camera_move_left", "camera_move_right", "camera_move_up", "camera_move_down")
            moveAmount = moveAmount.normalized()

            if !isDragging:
            	moveTarget += moveAmount * 15 * 1/zoom.x
            	position = position.lerp(moveTarget, 7 * delta)

            func ClickAndDrag():
            if !isDragging and Input.is_action_just_pressed("camera_pan"):
            dragStartMousePos = get_viewport().get_mouse_position()
            dragStartCameraPos = position
            isDragging = true
            if isDragging and Input.is_action_just_released("camera_pan"):
            isDragging = false
            moveTarget = position

            if isDragging:
            	var moveVector = get_viewport().get_mouse_position() - dragStartMousePos
            	position = dragStartCameraPos - moveVector * 1/zoom.x

            func focus_on_object(object):
            moveTarget = object.global_position`

            Now I'd like to limit the camera to a predefined area, but trying to do so with the built-in limit variables can make it act funky. Any suggestions?

            • xyz replied to this.
            • In help

              Maybe change
              @export var sprite3d = Sprite3D
              to
              @export var sprite3d: Sprite3D
              ?

              • Either a 2d side scrolling soulslike-metroidvania similar to Hollow Knight, or a turn-based RPG similar to Paper Mario.

              • I want to make a My Singing Monsters clone in Godot 4. The idea is to make a base "Grid Object" class that can be clicked on to be "selected," upon which a menu will appear with options such as "move," which will put the object into a moving state, allowing it to be dragged across the world, automatically snapping to the grid. Objects such as Decorations, Structures and Monsters will inherit from this base class, but with different options appearing upon being clicked (ex. monsters would have an option to "feed" them, structures would have unique functions.)

                Would anyone have any advice for how to implement a system such as this or tutorials I could be pointed to?

              • I'm using a pixel font with a label, and I'm trying to use the Label's built-in outline. It looks normal in the editor, but when I run the game, the outline appears rounded. How can I fix this?


                (Label in editor)


                (Label when running)

                • This post is a bit old but I just ran into the same problem.
                  Go to Project Settings > GUI > Fonts and uncheck "Use Oversampling"
                  That should get rid of the rounded outline.

              • I'm trying to make a heart UI system and I'm using a TextureRect with an AtlasTexture, but the Tile Stretch Mode won't work. With the Tile Mode on, my texture just stretches. Any solutions, or is this a bug?