This plugin allows the user to further customize projectiles. You can choose between several presets including: Sine wave, Orbiting, Boomerang, Arc, and further customize the parameters in built-in events. I have a couple ides for future presets, but leave a message if you have any additional requests. 

There's an example game above to show off a couple of features possible with the plugin. In the Kiloman and Fortmania stage press Select to cycle between projectile types.

The plugin is free to use in your projects. As an added bonus for the kind souls who wish to support the plugin, you will get access to the project files to the example above. Credits are appreciated and I would love to see what you are able to do with the plugin. 


Download the zip file and unzip the contents in your projects plugin folder.

The resulting folder structure should be : C:\PATHTOPROJECT\PROJECT_DIRECTORY\plugins\CustomProjectile

There are currently two versions of the plugin. One that works for projects on 4.1.2 and above, and one that works on 4.1.1 and below. I will probably stick with 4.1.2 and above for future updates.

The plugin will not be compatible with other plugins that modify projectile.c and .h. You will have to manually merge them in that case.  This plugin also modifies the projectile_t struct in gbs_types.h. So if there is another plugin that modifies the same file, you can simply copy over the projectile_t struct and delete the gbs_types.h file in this plugin.


After installing the plugin, simply add the "Custom Projectile" event anywhere before the "Launch Projectile" event, and fill in the desired values.

Projectiles Tab

Default: The standard projectile.

Arc: Create an arc trajectory, using the height and gravity parameters.

Boomerang: Adds a resistance value which will eventually make the projectile come back to the source.  Play around with the speed parameter in the launch projectile event with different resistance value until you get your desired effect. You can also allow the projectile collide with the player if you want the projectile to disappear on return.

Sine Wave: Whip out your high school physics book and play with the amplitude and frequency of a Sine wave. Or add 64 to the phase and get a cool Cosine wave.  If you're feeling fancy you can launch two projectiles with a difference of 128 making a double helix like pattern,

Orbit: Sine waves are nice but orbits are nicer! Specify an actor for projectiles to orbit around. If you want several orbiting projectiles you can specify their phase (0-255) to set their starting position.  You can also adjust an X and Y offset to fine tune the center of the orbit.

Hookshot: This projectile type is the most involved and requires additional set-up by the user.  The main projectile should be selected as head, which additional chain projectiles will use to calculate the distance from the head to the player. You can decide between having 0 to 3 chains in addition to the head. I recommend keeping the player stationary while the projectile is shot, and return control when the head collides with the player. The hookshot is based on states which can be controlled with the Set Hookshot State event. When launched the hookshot starts in the firing state, and can be set to automatically change to the "returning" state if it collides with a tile collision.  If you want actors to be pulled by the hookshot you can set the state to "pull actor" when the actor collides with the projectile. Or set it to "pull player" if you want the player to be pulled towards the actor. Since the hookshot projectile ignores projectile lifetime, you will have to manually remove it. This is done using the "remove" state. You can add this to the projectile's collision with the player while also returning control.

Custom: Not happy with the built-in presets? Make your own path! You can now control the X and Y deltas of the projectiles by specifying your own variables. These variable values can be adjusted in other events, so the sky is the limit here!


Properties Tab

The properties tab include more general settings for projectiles. 

Infinite lifetime bypasses the lifetime of the projectile. There is a corresponding event "Set Projectile Lifetime" if you wish to toggle this.

No bounds allows projectiles to extend beyond the screen width and height, and will cause the the projectiles to wrap to the other side of the screen.

Gravity gives projectiles a downward (or upward!) momentum imitating gravity.

Collision behavior allows the user to select what happens when projectiles collide with tile collisions.  You can ignore collisions, remove the projectile, make the projectile bounce off it, or only bounce off floor collisions. You'll want to play around with the speed and amount of collision tiles you have if you encounter any problems.

Lastly there's the ability to update user selected variables on the x and y coordinates of projectiles when they are removed. This can be used to create effects like fire or explosions. Or simply as a way to check when collisions are removed.

Published 3 days ago
StatusIn development
CategoryTool
PlatformsHTML5
Rating
Rated 5.0 out of 5 stars
(1 total ratings)
AuthorFredrik
TagsGame Boy, gb-studio, gbstudio, plugin

Download

Download NowName your own price

Click download now to get access to the following files:

Projectile Plugin for 4.1.2 and above.zip 12 kB
Projectile Plugin for 4.1.1 and below.zip 13 kB
ProjectilePluginProjectFiles.zip 429 kB
if you pay $1 USD or more

Development log

Comments

Log in with itch.io to leave a comment.

Excellent work! Thanks so much for sharing this.