Code Monkey home page Code Monkey logo

godot-addon-animated-shape-2d's Introduction

Hello World

As a kid I learned how to read in a BASIC manual because I wanted to code my own video game. That pretty much says it all about me.

I'm making a game of Go that is played on a planet. (my arlésienne)

Meanwhile, you can play Cyx, it's easy and fun.

Some Metrics

Metrics

Note: I produce code across many software forges, and some of them are private. The metrics above look only at Github, which I'm slowly leaving altogether.

godot-addon-animated-shape-2d's People

Contributors

goutte avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

godot-addon-animated-shape-2d's Issues

Frame data shifting

Add two action buttons that move the targeted frame shape data to the left or to the right in the animation, pushing other frames as needed, and cancelling if there is no room.

Useful when one has added new sprite frames to the animation, and wants to update the shape data accordingly.

Rename `AnimatedShape2D` into something else

A object worthy of the name AnimatedShape2D should extend Shape2D.
Preferably in C++. Doing its own thing, by the way, probably.

Let's not collide with that.


This addon provides a simple Node that couples an AnimatedSprite2D and a CollisionShape2D, using a database.

Ideas

  • CollisionShapeFrames
  • AnimatedSpriteToCollisionShape2D
  • AnimationToCollision2D
  • AnimatedSprite2DCoupler
  • AnimatedSprite2DCollisions

Of note:

  • The Node should probably not end in 2D, since it is not a Node2D.
  • Yet it should not collide with 3D either, in the best of cases.

I'll let this sit for a while. (until v2)

Then we'll vote on the fedi. Probably using Majority Judgment.

Do chime in ; let's hear your name candidates !

Add a mouse-based GUI editor for shapes

Something that will show up in the main 2D editor like so :

image

There's a lot of things to do for such a feature.
But since I'm dogfooding this addon, I want this.

Not able to edit the shape at all

Hi,

I added your plugin, enabled it and then added the new AnimatedShape2D to my player node.
There I selected the animated sprite and collision shape and then added a new ShapeFrame.
image

When I now open the Animated Shape tab, the animations are listed, but when I click on them nothing happens
image

There's also a bunch of errors in my output log which might be related to that problem.
image

Do you have any suggestions on how I can fix that?

Support for metadata on shape frames

This only needs a public endpoint to access the current shape frame, if any.

Rationale

I'm also using this plugin to add extra information on each animation frame, and it's been delightful for things like is_before_slash on startup frames.

Using this in AnimatedShape2D, and a get_meta on the result when not null:

func get_current_shape_frame() -> ShapeFrame2D:
	var animation_name := self.animated_sprite.get_animation()
	var frame := self.animated_sprite.get_frame()
	return self.shape_frames.get_shape_frame(animation_name, frame)

The metadata records are added in the Editor, as metadata of a single ShapeFrame2D. Shallow and deep copies seem to work as expected.

image

UndoRedo history mismatch

This error message crops up when using the addon.

I'm not sure what we're doing wrong to warrant such an error.

I'll keep an eye out, but if you know why this is happening, please share.

About making convex polygon shapes

This plugin is meant to be used along with a CollisionShape2D, and not a CollisionPolygon2D.

There is a Shape2D Resource named ConvexPolygonShape2D, but Godot's Editor is not activating a GUI to edit the points like it does for CollisionPolygon2D.

This is because the CollisionPolygon2D allows "concave" polygons by using multiple convex shapes internally.

How to generate a ConvexPolygonShape2D

  1. Create a CollisionPolygon2D
  2. Use the Editor to add/edit points
  3. Ensure you made a single convex shape
  4. Use the following Node to extract a ConvexPolygonShape2D from it.
@tool
extends Node
class_name CollisionPolygon2DConvexShapeExtractor


## Extracts a ConvexPolygonShape2D from a CollisionPolygon2D.
## THE SHAPE MUST BE CONVEX -- DO NOT MAKE CONCAVE SHAPES.
##
## Usage:
## - Add anywhere
## - Target an input polygon and an output shape
## - Reopen the scene in the Editor
## - Save the generated shape to a file using the Editor
##
## Be careful if you leave `shape` defined, it will write in it.


@export var polygon: CollisionPolygon2D
@export var shape: ConvexPolygonShape2D


func _ready():
	extract()


func extract() -> int:
	if polygon == null:
		push_error("CollisionPolygon2D is null")
		return ERR_CANT_ACQUIRE_RESOURCE
	
	if shape == null:
		shape = ConvexPolygonShape2D.new()
	
	shape.points = polygon.polygon
	
	return OK

Improve onboarding

  • Make sure there are no errors when required properties are not set
  • Explain about required properties in the bottom panel
  • Update the bottom panel when AnimatedShape2D properties change

Help solving physics discontinuity

This addon works great for hitboxes and hurtboxes.

But for solidboxes, sometimes it creates glitches in the physics engine due to the discontinuity of the boxes.

Example:

inscrutable-2024-01-08_06.49.55.mp4

The character gets stuck because its solidbox goes from a small square to a much bigger rectangle in a single physics frame.


To mitigate this, this addon could perhaps enforce some continuity using tween or something akin, making sure that the dimensions (and position) of the collision shape do not change too much each physics frame.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.