Jumper
By Pyledrvr010


Randomly generated, fast paced platformer. Can you escape The Dungeon?

Play Now

Platforms:

Status:

Work in Progress

Genre:

Platformer

Audience:

Everyone

Other devlogs on this game:

Devlog #3 - Jumper Task Update
Devlog by Pyledrvr010 on May 9, 2017.


Devlog #2 - Procedural Generation
Devlog by Pyledrvr010 on April 24, 2017.


Devlog #1 - Jumper
Devlog by Pyledrvr010 on April 21, 2017.


Devlog #1 - Jumper (Edited)
By Pyledrvr010 on April 21, 2017, 7:56 pm.


Okay so this if my first attempt at a Devlog so here we go.

This project originally was supposed to be a side-scrolling platform with some combat in it, the title was Businessman and I was excited. I worked on that concept for a while before I realized that I had no idea how to use the Unity Engine fully. After working for quite some time on the art of the first concept, I begrudgingly set that project aside and decided, "Before I work on a project I care about, Ill make a simple one to learn the basics." Moreover, that is how we got Jumper.

The idea behind Jumper is an up jumping platform game where the goal is to reach the top. After some research, tutorial watching and some forum reading I was able to get my concept to the small screen%u2026my phone. The project was built and I am eager to go! The project started out as my concept game and when the player swiped left or right the character would run accordingly, though that project was put on hold I did attempt to use that feature in this game. The player then would swipe down to stop moving entirely or swipe up to jump. After some play testing I realized these kind of controls were not fitting to the simplistic yet challenging feel of the game I wanted to design so I scrapped it and went to a simpler approach, tap to jump. I was feeling good about the development of my game and just when I thought I had it all under control I forgot about one thing, the platforms. Yeah my player could jump but he would collide with the platforms stopping him from moving to the next platform. Well after some researching online I was able to find the (my) solution to the problem. Here is where we start talking about the right now and what is going on.

My character object is was setup with the intention of the player being able to move left and right. Even though that was scrapped, I still left some of the collision detection the same. My character comprises of two collision detectors: a circle collider at the feet (small), and a box collider that covers his body. The idea behind this was a circle collider makes moving horizontally in a 2d world much easier and would allow him to go up slopes if thats where I decided to take it. This collider also allowed for some pretty interesting collision detection manipulation.

While forum hopping on how to solve the issue of jumping through a platform I read that Unity 5 had a built in feature that allowed for this issue to be handled easier then I was making it. Im currently using Unity 4.3 and have no intention of changing so that solution wouldnt work for me. I also saw people using a function like this to solve the problem:

Physics2D.IgnoreLayerCollision(layer1,layer2,bool)

The purpose of this function is that you pass in two layers and then a boolean to determine if the layers collision should be ignored or not. This works great for some but I could not get it to work and frankly I did not like the way it was implemented and decided to go a different route. What I ended up with that works for me is to disable the collision detectors when jumping. Now some of you may be thinking %u201CBut wont your character get stuck when the colliders turn back on?%u201D. The answer to that question is design. My game is designed so that my player will always jump high enough to clear the first platform, BUT the player may overlap the platform above that before falling back down. The way I fixed this is like this:

If (Player.Velocity.y > 0) {

          TopCollider.enabled = false; //Referred to as this from now on but originally box collider.

          BottomCollider.enabled = false; //Same as above but the circle collider

}

Else If(Player.Velocity.Y < 0) {

          BottomCollider.enabled = true;

}

Else {

          BottomCollider.enabled = true;

          TopCollider.enabled = true;

}

The way this works is that when the player jumps their velocity is greater than 0. To get above the platform I disable both colliders on my player object. Now as the player reaches the apex of their jump their velocity is decreased to below 0 to start the decent and to prevent the player from possibly colliding with a higher up platform because the feet will never overlap with the second platform thus our player will never get stuck this way. Now when the player lands on the platform below their Y velocity is going to be 0 and now both colliders are active and the cycle starts all over again.

This system isnt perfect especially if I wish to add hazards later when jumping but it helps me get my MVP (Minimum Viable Product) out the door. A better system would be to have a trigger that when the player enters the trigger it disables the colliders and then when the player exits the trigger it re-enables them. Some psudo code would be like:

If(Player.enters(trigger)) TopCollider = BottomCollider = false;

Else if(Player.exits(trigger)) TopCollider = BottomCollider = true;

This would be placed slightly under the platform and then even with the top of the collider for the platform. As the player entered this would trigger for the colliders to deactivate and then reactivate as the player exited either above or underneath.

Thats all for now, next time Ill give an update on where Im at and then talk about my wallTileing script I found and how I plan to use it for procedural generated levels.




No comments yet.