Instructions For Starting Your Platformer
First of all, open a new 2D project in Zero, name it firstnamelastnameplatformer (using your own first name and last name).
Now create all of the levels that you will need:
Press Space, then type add, then level then name the following levels:
If you name your levels differently than this, you will need to update your scripts to ensure that they reflect the new names.
Next, import the following scripts found below:
Following this, it is time to start creating game objects. On Level1, create one sprite, call it Player and add the following components to it:
Make it an archetype.
Next create another sprite, call it Enemy and add the following components to it:
Make it an archetype.
Next create another sprite, call it PlayerBullet, change size to 0.2, 0.2 and add the following components to it:
Make it an archetype.
Next create another sprite, call it EnemyCollider make it slightly larger than the enemy and add the following components to it:
Now move it to the same location on the screen as the enemy so that it overlaps, and parent it to the Enemy object in the objects panel.
Now, make the Enemy object an archetype, and the collider will be a part of it.
Finally, make a series of sprites of different sizes, for example: 1 x 1, 1 x 3, 1 x 5, 1 x 10, 1 x 15, 1 x 20. Give them the following components:
Make each an archetype and name them floor1, floor3, floor5 etc. You can now drag out whatever floor sizes you need to your game surface rather than creating new ones for each platform.
Now create all of the levels that you will need:
Press Space, then type add, then level then name the following levels:
- Level1
- Level2
- Level3
- Opening
- Death
- Win
If you name your levels differently than this, you will need to update your scripts to ensure that they reflect the new names.
Next, import the following scripts found below:
- CameraLogic
- DamageOnCollide
- EnemyDamageOnCollide
- EnemyHealth
- EnemyLogic
- Health
- LevelChange
- LevelVars
- PlayerController
- PlayerAnimation
- EnemyMovement
- PlayerShoot
- Sweptcontroller1
Following this, it is time to start creating game objects. On Level1, create one sprite, call it Player and add the following components to it:
- Player Controller
- Orientation – set Global Up to 0, 0, 1 and DefaultOrientation to ForwardXUpZ
- RigidBody – set to kinematic, rotation lock to true.
- Boxcollider – Set Ghost to False
- Health
- SweptController – adjust preferences to your liking
- PlayerAnimation – add sprites for different movements
- PlayerShoot
Make it an archetype.
Next create another sprite, call it Enemy and add the following components to it:
- RigidBody set rotation lock to True
- Boxcollider – set Ghost to False
- EnemyHealth
- EnemyMovement – adjust left and right boundaries as necessary.
Make it an archetype.
Next create another sprite, call it PlayerBullet, change size to 0.2, 0.2 and add the following components to it:
- RigidBody
- SphereCollider – set Ghost to True
- DamageOnCollide – set Damage to what you want, and the other two select true
- IgnoreSpaceEffects – set Gravity and Drag to True
Make it an archetype.
Next create another sprite, call it EnemyCollider make it slightly larger than the enemy and add the following components to it:
- RigidBody – set rotation lock to True, and dynamic state to Static.
- BoxCollider – set Ghost to True
- EnemyDamageOnCollide – set Damage to what you want, and the other two select true.
Now move it to the same location on the screen as the enemy so that it overlaps, and parent it to the Enemy object in the objects panel.
Now, make the Enemy object an archetype, and the collider will be a part of it.
Finally, make a series of sprites of different sizes, for example: 1 x 1, 1 x 3, 1 x 5, 1 x 10, 1 x 15, 1 x 20. Give them the following components:
- BoxCollider – set Ghost to False
Make each an archetype and name them floor1, floor3, floor5 etc. You can now drag out whatever floor sizes you need to your game surface rather than creating new ones for each platform.
Design Time
It is now time for you to import your own sprites or design your own, and add them to each level to create functioning game play. Remember to add backgrounds, sprites to walls and to your characters and enemies to ensure that you have a well-rounded experience for the player. Also keep in mind that you will need to create artwork for the opening screen, Win screen and Death screen. You can add multiple enemies, and you can create new archetypes from the old one changing the damage and health and speed. The enemyMovement script has the enemy pace back and forth. If you wish to use a different Ai script you can get them from the script library.
Level Changing
You have probably noticed that your game errors on player death, and just continues after your player has destroyed all of the enemies. I am including a script that changes levels after all of the enemies have been destroyed. If you want to change levels for a different reason: ie. Entering a portal, you will need to modify the script to include that event. You can use a collision event for a portal, or you could have a gameobject that needs to be destroyed to change the level.
Go to each level, and on each one add the following components to the LevelSettings object:
Go to each level, and on each one add the following components to the LevelSettings object:
- LevelVars
- LevelChange – set timer to what you want.
cameralogic.txt | |
File Size: | 0 kb |
File Type: | txt |
damageoncollide.txt | |
File Size: | 2 kb |
File Type: | txt |
enemydamageoncollide.txt | |
File Size: | 2 kb |
File Type: | txt |
enemyhealth.txt | |
File Size: | 2 kb |
File Type: | txt |
enemymovement.txt | |
File Size: | 1 kb |
File Type: | txt |
health.txt | |
File Size: | 2 kb |
File Type: | txt |
levelchange.txt | |
File Size: | 4 kb |
File Type: | txt |
levelvars.txt | |
File Size: | 0 kb |
File Type: | txt |
playeranimation.txt | |
File Size: | 1 kb |
File Type: | txt |
playercontroller.txt | |
File Size: | 1 kb |
File Type: | txt |
playershoot.txt | |
File Size: | 1 kb |
File Type: | txt |
sweptcontroller1.txt | |
File Size: | 34 kb |
File Type: | txt |