GDevelopApp / GDevelop-extensions

Repository of behaviors, actions, conditions and expressions to be used in GDevelop for creating games
https://gdevelop.io
MIT License
133 stars 53 forks source link

Rotate objects around player #116

Closed VegeTato closed 3 years ago

VegeTato commented 3 years ago

Describe the extension

This extension will help in making objects rotates around another objects(could be player) or any object for example: making shields that rotates around the player to protect him from enemies upcoming bullets Can take up to 3 objects to rotates Users can set the Speed of the rotating objects around the player *Users can set the Distance between the objects and the player

Checklist

Extension file

Rotate Objects around player Extension.zip

                                     Gif shows the Extension job in action:

ExtensionReview

tristanbob commented 3 years ago

Great work @VegeTato! I am going to look at this (hopefully) tonight. Based on our discussion on Discord, here are some ideas I will look into:

tristanbob commented 3 years ago

Good news, I got all my desired functionality working! @VegeTato this version will let you use multiple objects at the same time on the same center object, but you will need to specify a StartingOffset and use a unique OrbitID string.

Version 0.3.0

Run this extension on every frame to make the orbiting objects move. This extension will create/delete orbiting objects to match the quantity specified. Use the delete function or set quantity to 0 to remove orbiting objects.

Extension parameters include:

Example uses:

Extension file

OrbitingObjectsExtension_0.3.0.json.zip

Example game

https://victrisgames.itch.io/extension-orbiting-objects

Video

https://user-images.githubusercontent.com/8879811/114340990-ff9c8b80-9b15-11eb-9bbe-f3d827a13bca.mp4

VegeTato commented 3 years ago

WOW ! it looks just PERFECT ! ❤️ great work ! Thank you for upgrading it to the MAXIMUM level ! 😄 hopefully they add it in the extensions of Gdevelop ^_^

tristanbob commented 3 years ago

@4ian - This extension is ready for your review. Thanks!

Bouh commented 3 years ago

image

4ian commented 3 years ago

Looks like a great extension! Happy to add it. Bouh remarks would be good to address. A rotation speed is indeed something that should be in "degrees per second".

Starting offset (angle in degrees)

I would rather say Angle start offset (in degrees)? We always put just the unit in parenthesis. E.g: (in pixels), (in degrees), (in degrees per second)...

There is a way to add long descriptions on input fields

Yep that's good to use I think. :)

The example is nice in any case! We could also include it in GDevelop examples.

tristanbob commented 3 years ago

I will update this extension tonight with the wording suggestions, and with using the long description (as needed).

I'll tag 4ian again when I have the new version uploaded. Thanks for the review and kind words!

4ian commented 3 years ago

Excellent!

tristanbob commented 3 years ago

Version 0.3.1

Extension file

OrbitingObjectsExtension_0.3.1.json.zip

@4ian this is ready for another round of reviews. :)

arthuro555 commented 3 years ago

There is a slight problem, __OrbitingObjects.OrbitQuantity can get out of sync if the user deletes an orbiting object. This makes the extension believe there is a specific amount of objects when there isn't.

Replicate: Take the example from @tristanbob, add this event: image Start a preview, hover over a few dinos, then play with the quantity slider. As you can see, it doesn't reflect the amount of objects anymore.

This is tricky to fix, the only way I can think of is to convert this to a behavior (you attach it to an object that you want to rotate, and can add an onDelete to update __OrbitingObjects.OrbitQuantity)

tristanbob commented 3 years ago

Interesting use-case, thanks for testing!

Do you think I should be able to count the number of OrbitingObjects that are linked to each CenterObject?

ForEach(CenterObject):
Condition:
Take Into Account "OrbitingObjects" Linked to "CenterObject"
Action:
Set Variable(CanICountThisWay) to count(OrbitingObjects)

I think I have tried this method but it didn't work. :-/

tristanbob commented 3 years ago

I have rewritten this extension to use the Count() function to track linked objects, instead of using a manual variable. The makes the extension smaller and simpler. However, I am going to pause working on this extension until I learn more about this bug:

https://github.com/4ian/GDevelop/issues/2560

tristanbob commented 3 years ago

Alright, I've made a lot of improvements and I'm ready for more excellent feedback!

Version 0.5.0

Extension file

OrbitingObjectsExtension_0.5.0.json.zip

Updated game

https://victrisgames.itch.io/extension-orbiting-objects

arthuro555 commented 3 years ago

After a quick look, this looks good to me!

tristanbob commented 3 years ago

Thanks for reviewing this @arthuro555!

@4ian We are ready for your review of this extension.

4ian commented 3 years ago

Great! I'll check that :) 👍👍

4ian commented 3 years ago

I've made a few changes in the description ("Run this extension" => "Run the action" (an extension is a set of action/condition/behavior, but we don't say to users to "run an extension", this can be confusing)). But apart from that this is very nice! Added it to the registry 👍

Thanks all!!