Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by barrycook · Mar 06, 2018 at 08:33 PM · 2dendless runnerground2d collisionkill player

2D enemy wave that the player can ride on but the front kills them in and endless runner.

Hi there, making my first game to learn how to use Unity with my friend doing art and animation.

I've been following this tutorial James Plus Games Endless Runner tutorial. Which has been great so far, but we wanted to change the gameplay slightly to make it more interesting.

In the original, the player is jumping from platform to platform and if they miss and hit the floor a 2d collider is killing the player via a tag of "killbox". We decided we wanted make our player a dinosaur that’s surfing along and instead of jumping on platforms we want him jumping over waves. To mix up things we wanted to make it so that if you hit the front of the wave it kills the player and if you hit the top of the wave it acts as the ground. So the player can effectively ride the top of the wave.

So in our game the floor doesn't hurt you but the front of the waves do. The camera follows the player so in the original the game objects are made active from a pool and the appearance of movement is given by the camera moving. But with the waves we wanted to move them so it looks more like they are coming toward the player. Which we can get working fine, using either waypoints using transform.position or using the constantforce2D component both options have their pro's and cons but in both I can only get the wave to either kill the player or alternatively the player can ride top like ground.

Things I've tried:

Making parent game object with two children game objects, once that’s got the "killbox" tag and one with the "grounded" layer.

And also one game object where the parent is either the killbox or the platform and visa versa.

But no matter what combination I try the wave is always either a killbox or the ground.

This is the logic for the player that checks if they have hit the killbox tag:

    void OnCollisionEnter2D (Collision2D other)
         {
     
             if (other.gameObject.tag == "killbox") {
                 theGameManager.RestartGame();
                 moveSpeed = moveSpeedStore;
                 speedMilestoneCount = speedMilestoneCountStore;
             } 


If you need anything clarifying then please let me know. Sorry if this seems like a silly question but I've been banging my head against this for quite awhile now and any help anyone can suggest is seriously appreciated.

Cheers Harry

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by barrycook · Mar 08, 2018 at 11:39 AM

Hi so I think the process of writing all this out basically helped the puzzle in my brain click into place. It was a case of my waypoints being prefabs, but also a child of the Camera object so that they had a static position.

And also the wave object being the ground and its child being the killbox. Both with 2d box colliders and neither having a ridgidbody2d component.

If anyone in the future is trying to solve a similar issue just let me know and I'll see if I can help.

All the best, Harry

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

205 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Object pooling system. Objects aren't spawning 0 Answers

Player Can walk through walls [2D] 1 Answer

2D Character gets stuck on boxes. 1 Answer

2D Collision Point 0 Answers

On 2D platformer, how to have the screen going after the player? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges