Search Unity

[RELEASED] Complete Physics Platformer Kit

Discussion in 'Assets and Asset Store' started by Greg-Sergeant, Oct 2, 2013.

  1. sirius_002

    sirius_002

    Joined:
    Aug 16, 2012
    Posts:
    65
    Has anyone been able to make AI jump up at the player in 2.5d mode? Right now when you jump on a platform your enemies just stand there below you waiting for you to come down. TIA!
     
  2. vastar

    vastar

    Joined:
    Apr 6, 2013
    Posts:
    25
    Hi greg how to resolve the problem from player jumping when running?
    This problem was mentioned in this post:




    first when i run on hit sometime i get little jump so player lose control and it's realy !!


    In "2d demo scene" downloaded from kit exist the bug.
     
  3. sirius_002

    sirius_002

    Joined:
    Aug 16, 2012
    Posts:
    65
    Try adding one big box collider instead of little small ones, you probably use tidy tile mapper which does this as a default.
     
  4. vastar

    vastar

    Joined:
    Apr 6, 2013
    Posts:
    25
    yes with a single collider works. I was trying to work this way, but
    work with many modular assets and this is very painful to add new colliders after the level is ready.
     
    Last edited: Jul 1, 2014
  5. Krinn_

    Krinn_

    Joined:
    Jun 29, 2014
    Posts:
    3
    Just add the collider to the first layer of blocks. There isn't really a point to add collider to other blocks. If you make a gap, well then add the colliders around walls aswell.
     
  6. DanielSnd

    DanielSnd

    Joined:
    Sep 4, 2013
    Posts:
    382
    If you're making the AI using Pathfinding, you might want to look into OffMesh Links. http://docs.unity3d.com/Manual/OffMeshLinks.html

    If you're not making the AI using pathfinding.... no idea D: make teleporting enemies that teleport on top of the player if the player is grounded on a higher Y position than they are? XD

    I found the problem on the same circustances you mentioned, my solution was also to create a longer collision box instead of several small ones that the tile mapper had given me.

    However I don't think I've seen this bug on the 2D Demo Scene of the kit o_O in which part of the scene did you find it?
     
    BuckeyeStudios likes this.
  7. sirius_002

    sirius_002

    Joined:
    Aug 16, 2012
    Posts:
    65
    Ok, thanks for the hint. I'll take a look at this, would be easier to make the enemies zombies, since they don't jump much lol. Maybe that's why there are so many zombie games, easier to program AI...
     
  8. vastar

    vastar

    Joined:
    Apr 6, 2013
    Posts:
    25
    sorry, my mistake, actually the demo scene does not contain the bug.
     
  9. serkanos

    serkanos

    Joined:
    Jan 12, 2013
    Posts:
    28
    WHy does he sliding on moving platforms? I couldnt fix this
     
  10. Krinn_

    Krinn_

    Joined:
    Jun 29, 2014
    Posts:
    3
    Thats just physics. Reducing the speed should fix this.
     
  11. DanielSnd

    DanielSnd

    Joined:
    Sep 4, 2013
    Posts:
    382
    http://en.wikipedia.org/wiki/Inertia
     
  12. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    I changed code and have now water swimming, i plan to add objects you catch that allow you to glide in the air. Perhaps i could send modified files to the author for some update when it's done ?
    EDIT :
    Seems in previous posts someone already done swimming code.
     
    Last edited: Jul 6, 2014
  13. Lakris

    Lakris

    Joined:
    Jan 10, 2014
    Posts:
    17
    Cool addons Daniel

    I've almost all i need working, but i have some small problems.

    Ladder = Im only able to use the ladder one time, after one climb, i can't do it again.

    Punch = I've tried lots of stuff, and im confused, its like my punchbox does'nt work(its also not working without=with yours), do it need to have a tag on my trigger called PunchBoxHit or...?

    OnewayPlatform = i have followed your exact formula, but it's not working. Character is that your name for Player? is that important in the layer setup?

    Thx
    Lakris

    EDIT: im using Unity free 4.5.1f3
     
    Last edited: Jul 6, 2014
  14. serkanos

    serkanos

    Joined:
    Jan 12, 2013
    Posts:
    28
    Hi. When I press the play it's creating a new gameobject under the player. And my problem, enemy hitting this object and player dead or damage. How I pull back in the middle of the player. I couldnt find which script that do it. Sorry my english.
     
  15. DanielSnd

    DanielSnd

    Joined:
    Sep 4, 2013
    Posts:
    382
    Well, that's the grab box, if you don't want to have it, remove the Throwing script from your character.

    I'll make a tutorial on implementing those tomorrow oky? XD
     
  16. Lakris

    Lakris

    Joined:
    Jan 10, 2014
    Posts:
    17
    That will be great :)

    on behalf of all the noobs... i salute you
     
  17. serkanos

    serkanos

    Joined:
    Jan 12, 2013
    Posts:
    28
    Thnks Daniel !
     
  18. Besus

    Besus

    Joined:
    Mar 9, 2014
    Posts:
    226
    For those who may be interested, here is volume 2 of my video development blog detailing how I am expanding this starter kit to feel much more complete in terms of modern platformer mechanics. In this video, I talk about improvements I made to my original wall jumping mechanics, how I implemented a ground slam ability (partially in thanks to Daniel's melee attack logic), and by far the most difficult item here, swimming that plays nicely with my powerups as well as the grabbing/throwing mechanics already in the kit!

    If you have any questions or would like more details regarding these additions, don't hesitate to ask. :)



    Keep in mind that I am by no means a C# expert; all of this was done through Google searches and combing through the Unity Answers and Forum posts in the search results.
     
  19. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Great progress.
    If we could combine all additionnal script code made by all people and have the author incorpoate them in the asset it would be great for all.
    For swimming another gameplay used in some games is a button t oswim down and another to swim to surface, this way you can still control camera vertically to look at what is going on and to avoid any camera problems.
    For swimming i implemented some sort of jump out of the water like in some games, so when character is near the surface if you jump you make a big jump out from water, so this is lot more easy to get out of water and for level design instead of must having each time some some transition zone (low level water above the floor).

    There is some people doing good also on the Mario 64 style, that's good to see coming pure entertainment games. After gameplay the level and ideas are the second big part.
     
    Last edited: Jul 7, 2014
    eiVix and uni7y like this.
  20. Besus

    Besus

    Joined:
    Mar 9, 2014
    Posts:
    226
    I definitely thought about using separate buttons for surfacing and diving but wanted to keep button usage minimal (for the time being) so I am using Jump to swim forward (holding it maintains a constant speed) and then the directions (normally used for movement) for the surface/dive/rotate. I'll probably explore allowing camera rotation (like the payer can do while not swimming) for underwater as well, and after so many seconds, returning the camera to the position behind the player.

    For now I was mostly concerned with making it all work as I hoped, but with that completed I can focus on minor (famous last words) tweaks. I will likely wait until I have created some of the actual levels to see if any potential tweaks would be a necessity.
     
  21. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Some cool move would be like Mighty N°9 , some aerial and ground dash allowing to pass larger areas impossible with jumping only.

    About modifications did you modify platformer game kit or added new C# components ?
     
  22. DanielSnd

    DanielSnd

    Joined:
    Sep 4, 2013
    Posts:
    382
    Alright, if you got Annotations enabled you can click on the annotations at the start of the video to jump to the component you want to see implemented :)

     
    elijahrockshout and cg_destro like this.
  23. cg_destro

    cg_destro

    Joined:
    Aug 13, 2013
    Posts:
    142
  24. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Yes thank you.
    You just need swimming gameplay now ;)

    Swimming implementation : click image to play video
     
    Last edited: Jul 8, 2014
  25. Besus

    Besus

    Joined:
    Mar 9, 2014
    Posts:
    226
    Everything that I implement is added to the existing scripts; for example my PlayerMove script is just over 1,000 lines now.
     
  26. DanielSnd

    DanielSnd

    Joined:
    Sep 4, 2013
    Posts:
    382
    I don't really need swimming gameplay on my game, but the way you're showing there is easy enough to do xD I just had to change the double jump enabler a little bit

    Infinite Jumping When Underwater



    Get it here: http://pastebin.com/s20CYamG

    Basically just drop the component into the player and that's it. I left a call to the animator commented with a bool in case you want to toggle some swimming animation.
     
  27. Dredo

    Dredo

    Joined:
    Jul 9, 2014
    Posts:
    1
    hi!
    Sorry, my english is bad(
    Help, how to connect mobile management, which is in this pack
    (Pictures found: Abutton ,bButton and joystick)
    or tell me another pack
     
  28. Artisiti

    Artisiti

    Joined:
    Oct 6, 2013
    Posts:
    26

    Awesome work m8. The only thing that is lacking is a ledge grab that enables me to push the character up. So when I jump near a platform and am close enought the character grabs it. When I press an action button the character should move up. :)
     
  29. DanielSnd

    DanielSnd

    Joined:
    Sep 4, 2013
    Posts:
    382
    I love this kit so much I used it to make a random soccer game between Germany/Brazil in which it's pretty much impossible for you to win XD (You control a brazilian player playing against germany lol, the game is as rigged as possible for you to lose.)

    http://gfycat.com/HospitableInformalIcterinewarbler#
     
    Besus and elijahrockshout like this.
  30. DanielSnd

    DanielSnd

    Joined:
    Sep 4, 2013
    Posts:
    382


    Well, it's all in portuguese, but you can play it here: http://polycarpgames.com/alemanha/web.html

    ASDW to move, Arrow keys to shoot the ball if it's in front of you.
    It's a "Simulator of Germany Vs Brazil", making fun of the game in Germany scored 7 goals in Brazil, so it's pretty hard/impossible xD and tha'ts the fun of it.
    Despite not being exactly a platformer, It was made with the Physics Platformer kit :) it helped a lot with getting the movements working (and the other AI players movement's too xD)

     
    Last edited: Jul 13, 2014
  31. BokuDev

    BokuDev

    Joined:
    Jan 2, 2014
    Posts:
    81
    Daniels scripts still work great even for 3D platformers! Love the melee attacks and ranged enemy stuff. Keep it up!


     
  32. DanielSnd

    DanielSnd

    Joined:
    Sep 4, 2013
    Posts:
    382
    It made me really happy to watch this video and see the stuff I made put to good use ^^ Thanks for sharing the video, it put a smile to my face. The game is looking quite good and fun :D
     
  33. Greg-Sergeant

    Greg-Sergeant

    Joined:
    Feb 18, 2011
    Posts:
    76
    Guys i want to say it is truly incredible to watch this community blossom! I always had wanted to offer something simple, with a low point of entry ($25) which had a lot of room for people to quickly learn and then build upon it, with the modular scripts, and i'm really happy to see the community come together like that. Big thankyou also to Daniel! With your permission, i'd like to include your add on scripts with the kit (full credit to you), in a "guest scripts folder" so that others can enjoy them, and build upon them.

    Also, very nice idea to use the kit for a football game! Are the players enemies who chase the ball, with a pushforce on their attack?

    Let me share a few ideas with the community which might inspire some of you:

    1. Flying Birds. Animate a bird flying around your level in unity engine and then just click "enable physics" and make it a "Pushable" item. Now you can grab animals to get around! (one of my main inspirations for this kit was the physics in Shadow of the Colossus:
    )

    2. Climbable giants. Animate a creature, add hitboxes to each limb, add rigidbody and then click animate physics. Voila, Shadow of the Colossus. You could even add "Pushable" areas to certain parts to hold onto. With impact damage enabled these would also give realistic damage when they hit you.

    3. Enemy limbs, which spawn on their death, which can be used as weapons. (just make the limb a pickup, then place it in the "spawn on death" list for the enemy. Reminds me of Medievil 1 where you could use an enemy arm as a club.

    4. Medusa's head. Make the head spawn after killing mesua like in suggestion 3. Make the head a pickup, and make it a trigger hazard. Make it only effect enemies, and when the enemies die put in a "frozen statue" version of them in their "spawn on death" objects. Voila. Zero custom scripting, but you have medusas head which appears to turn enemies into statues. You can use the same logic for an item which un-freezes them.

    I had hundreds of ideas like this when coming up with the kit but do not wish to make it too complex for beginners, so i left them out, but there are many possibilities already, only your imagination is the limit! Thanks guys, i'm really glad everyone is enjoying the kit.

    PS: i have a new game i'm trying to get greenlit and if you have a few moments please go and vote YES to help out, thankyou! http://steamcommunity.com/sharedfiles/filedetails/?id=284552004
     
    elijahrockshout likes this.
  34. DanielSnd

    DanielSnd

    Joined:
    Sep 4, 2013
    Posts:
    382
    Sure thing :D I hereby grant you full permission to include my addon scripts posted in this thread on the Kit \o

    The Germany-side players are enemies with a pushforce on their attack (The force direction is calculated based on Brazil's goal position.) If they realize they're touching the ball but rotated away from brazil's goal position they turn off physics on the ball and Tween animated the ball to jump over to their back, proceeding as usual after they're now rotated towards brazil's goal position :D

    Already voted YES on your new game a few days ago ^^ I'm a huge fan of your work and I follow your blog xD

    If you're reading this and you don't know Greg's other games, you should head over to his website and try it right now :D They're awesome!
    My favorites are: Demonic Dungeon, Skullface, Making Monkeys and Use Boxmen.

    I want to make a game like Demonic Dungeon one day <3 but with procedural level generation, lock&keys on each level and bosses :D
     
  35. BokuDev

    BokuDev

    Joined:
    Jan 2, 2014
    Posts:
    81
    Has anyone tried adding sounds to the melee attacks, double jump or foot-steps? Iv been trying to get a attack-sound to play for each animation like "left punch" or "right punch". A second jump sound for the double jump, and footsteps since the PPK is creepy quiet. (So if I have 4 sword swings there is 4 different attack sounds).

    Here is what it looks like in the inspector so far. Just can't seem to get them to play now.


    Iv also done the same thing to gregs "player move" script. Though it keeps playing only one jump sound though, and not both at the same time, or after one another. Though I'm sure a solution where there could be 8 jump sounds (and cycle) when jumping it will play a random jump sound out of that 8 is way better than just 1 looping annoying jump sound for the player.




    Going to also play around with footsteps for the next couple weeks. (might post in paste bin as well my C# solution for foot steps later since I'm sure others can fix it to work properly even more). There is some problem with it, but it works 100% fine on an Xbox360 controller but not on keyboard.

     
  36. DanielSnd

    DanielSnd

    Joined:
    Sep 4, 2013
    Posts:
    382
    Assuming you have an audio source component on the same gameobject as this script:

    Code (csharp):
    1.  
    2. //This is the sound to play
    3. public AudioClip Sound;
    4.  
    5. void PlaySound() {
    6. audio.clip = Sound;
    7. audio.Play();
    8. }
     
  37. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Well you could also check out our flagship product Master Audio here: https://www.assetstore.unity3d.com/en/#!/content/5607

    It's got tons of "no code needed" ways to play sounds, music, including "on Mechanim event changed". It has super advanced options that you might find yourself wanting but don't want to spend months creating.
     
    BokuDev and DanielSnd like this.
  38. GiusCo

    GiusCo

    Joined:
    Aug 1, 2009
    Posts:
    405
    Hello folks, I'm in this too, nice to meet you... just read the topic in full, excellent contribution from OP Greg, Daniel and other guys, very well done, thanks .... this will be my 3rd game as a one-man band / hobbyist, so planning to stick with 2.5D format in order to get assets and modding not overly complicated, work into weekends and deploy to iOS at the end of November

    - first step will be making a narrative and add dummy intro scene - menu - GUI - end scene for sake of completeness

    - second step will be integrating with iOS Native for iAds, leaderboards and in-app purchases

    - third step will be defining the level and reskin with my own theme (art, sounds)

    (- fourth step would be adding missions, levels / power-ups / final boss to fight but I'm not sure I can do it)


    Pretty up then, I will update here if you like. Thanks again and keep the gode vibe going. Gius.
     
  39. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Hi, we're having a problem where when our player is riding a vertically moving platform, sometimes when it starts to move up, the player falls right through the platform. Has anyone else seen / solved this problem? If so, how?
     
  40. CircusCharlie

    CircusCharlie

    Joined:
    Jul 22, 2014
    Posts:
    38
    Hi.. I love your pack. I am new to Unity. Can you please explain me (in as much detail as possible :) ).. How to replace the cube character by my own character. Ad how to put enemy instead of the cubes, Thanks a lot in advance.
     
  41. DanielSnd

    DanielSnd

    Joined:
    Sep 4, 2013
    Posts:
    382
     
  42. CircusCharlie

    CircusCharlie

    Joined:
    Jul 22, 2014
    Posts:
    38
    Thanks a lot Daniel
     
  43. elizeusz

    elizeusz

    Joined:
    May 2, 2012
    Posts:
    49
    Hi All ! :) I think i found bug in this framework. I made video because my English is not very good and my explanations could be not enough :D anyway problem is with Hazard red box in test scene. I have attach to it constant rotate script. What You can see on the video is the player which is going to this box and he get hit but when You stay and doing nothing (idle state) there You will not get any hurt. Any help or suggestion will be nice :)
     
    BokuDev likes this.
  44. elizeusz

    elizeusz

    Joined:
    May 2, 2012
    Posts:
    49
    Here is another one but with enemy if you are moving to the enemy ( hold left or right arrow all the time ) You will get hit only once what you can see on the video
     
  45. BokuDev

    BokuDev

    Joined:
    Jan 2, 2014
    Posts:
    81

    Iv had this happen to me while I was making some enemies a ton of times. I would stand still and standing still even while the enemy's attack bounds trigger is colliding with the player hitbox I wouldn't take damage as well.

    I ended up making the attack bounds bigger and instead of happening a lot, it happened only once or twice out of 50 times I killed an enemy.

    It is a strange bug.
     
  46. DanielSnd

    DanielSnd

    Joined:
    Sep 4, 2013
    Posts:
    382
    That's an interesting problem. The enemy is checking for the Trigger Enter by default, instead of Trigger Stay, you have to change it. Go into enemyAI.cs and on line 91 change:
    Code (csharp):
    1. if (attackTrigger && attackTrigger.collided)
    To:
    Code (csharp):
    1. if (attackTrigger && attackTrigger.colliding)
    Now that creates another problem, your character won't be hit while he is flashing for the last hit he took, but he will still be pushed every frame, so you need to go to the DealDamage.cs script and make a few changes.

    Delete line 22 to 24 of DealDamage.cs
    Code (csharp):
    1.  
    2. //deal dmg
    3. if(health && !health.flashing)
    4.      health.currentHealth -= dmg;
    5.  
    And paste it right before //push (line 12)
    So it is:
    Code (csharp):
    1.  
    2. //deal dmg
    3.        if(health && !health.flashing)
    4.             health.currentHealth -= dmg;
    5.         else
    6.             return;
    7.         //push
    Now for the hazards, go into Hazard.cs and change line 27:
    Code (csharp):
    1. void OnCollisionEnter(Collision col)
    To:
    Code (csharp):
    1. void OnCollisionStay(Collision col)
    That should solve that problem.
     
    BokuDev likes this.
  47. elizeusz

    elizeusz

    Joined:
    May 2, 2012
    Posts:
    49
    Wow thanks Daniel :) Your first explanation about enemy is working for me great :) But this about hazard.cs still same situation.
     
  48. DanielSnd

    DanielSnd

    Joined:
    Sep 4, 2013
    Posts:
    382
    Over here I can't reproduce the problem with the hazard after making the Fix, are you using Collision or Trigger on hazard? If you're using trigger you need to change line:
    Code (csharp):
    1. void OnTriggerEnter(Collider other)
    to
    Code (csharp):
    1. void OnTriggerStay(Collider other)
     
  49. elizeusz

    elizeusz

    Joined:
    May 2, 2012
    Posts:
    49
    I use Collision one.
     
  50. DanielSnd

    DanielSnd

    Joined:
    Sep 4, 2013
    Posts:
    382
    I can't reproduce the problem then, after the changes it just works here D: Are you sure you made the correct changes?