Script Library Platformer 2D
Particle Effect triggered on collision
particle_effect_on_collision.txt | |
File Size: | 0 kb |
File Type: | txt |
Used to create a particle when a character collides with a block and destroys it (think Mario). If you create a child collider at the top of your character that is trigger then use this script on the block that you are wanting to break you will just need to create a particle effect and add it to the inspector and create a tag for the collision event to detect.
Changing Blocks:
blockchange.txt | |
File Size: | 2 kb |
File Type: | txt |
Script that changes block colour over time, changes the box collider to "is trigger" after a set amount of time so that players cannot collide with the platform.
Variables:
SwitchTime: set to the number of frames that you want the block to be active.
BlockA: boolean to choose two different groups of blocks (One will be active while the other is inactive).
This script needs to be placed on the block object.
Variables:
SwitchTime: set to the number of frames that you want the block to be active.
BlockA: boolean to choose two different groups of blocks (One will be active while the other is inactive).
This script needs to be placed on the block object.
Player Health:
player_health.txt | |
File Size: | 1 kb |
File Type: | txt |
Same script from Top Down Arcade.
Player Shoot with rotate to direction of force(like for arrows):
playershoot_with_bullet_rotation_to_force.txt | |
File Size: | 2 kb |
File Type: | txt |
Mouse shoot from Top Down Arcade, includes rotation of projectile in direction of force so that things like arrows don't shoot sideways. Make sure that you create your bullet object facing right (positive in the x axis) so that it rotates correctly.
Player Input:
player_input.txt | |
File Size: | 1 kb |
File Type: | txt |
Works with player Controller (see below), includes an onTriggerEnter2D method for a modification of jump height when the player object collides with a power up.
Player Input With Crouch Animation:
player_input_with_crouch.txt | |
File Size: | 3 kb |
File Type: | txt |
Adds a new animation to the existing Player Input script. Also includes double jump and jump cancel. You will need to:
-open animation window, select the player object and create a new animation using a series of sprites like you did with the run, idle and attack animations.
-In the animator create a parameter called PCrouch and make it a bool.
-Create transitions from any state to crouch with PCrouch as true, and from crouch to idle with PIdle as true, make sure you uncheck can transition to self.
-open animation window, select the player object and create a new animation using a series of sprites like you did with the run, idle and attack animations.
-In the animator create a parameter called PCrouch and make it a bool.
-Create transitions from any state to crouch with PCrouch as true, and from crouch to idle with PIdle as true, make sure you uncheck can transition to self.
Player Controller:
player_controller.txt | |
File Size: | 9 kb |
File Type: | txt |
Works with player input (see above) used in the platformer tutorials.
Pickup Destroy:
pickup_destroy.txt | |
File Size: | 0 kb |
File Type: | txt |
Use to destroy any pickups that your player collides with, object must have a 2D collider attached and have it set to "isTrigger".
Checkpoint
checkpoint.txt | |
File Size: | 1 kb |
File Type: | txt |
Use to add checkpoints in your levels, see the checkpoints tutorial on how to implement in your game.
Camera Follow:
camera_follow.txt | |
File Size: | 1 kb |
File Type: | txt |
Same camera follow script from top down arcade.
Parallax:
parallax.txt | |
File Size: | 0 kb |
File Type: | txt |
Creates a parallax effect for backgrounds. Same as tutorial script but also includes movement in the y axis.
Data Manager:
data_manager.txt | |
File Size: | 0 kb |
File Type: | txt |
Same Data Manager from Top Down arcade. Has a lot of example variables, feel free to delete the ones that you will not use.
Level Change:
level_change.txt | |
File Size: | 1 kb |
File Type: | txt |
Same Level Change from Top Down Arcade.
Enemy Move, Shoot and Health:
enemy_move_and_health_platformer.txt | |
File Size: | 6 kb |
File Type: | txt |
Script has the enemy move towards the player and shoot when they are in range. When the enemy walks off of a platform they drop without movement until they collide with a platform again. Ensure that you have a tag on your ground tilemap called "Ground" and read all of the notes at the top of the script.
Moving Platform:
moving_platform.txt | |
File Size: | 2 kb |
File Type: | txt |
player_input_method_for_moving_platforms.txt | |
File Size: | 0 kb |
File Type: | txt |
Use the first script on the moving platform object, read the notes very carefully so that you add all of the components that are needed to operate the platform. The second script is an onTriggerStay2D method that needs to be added to the player input script to move the player when they are on the platform. If you do not add this method to the player input script the player will not move and the platform will slide out from underneath them.