Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 /
avatar image
0
Question by LeonardChallis · Jul 21, 2017 at 09:01 PM · 2d-platformerrepeatingendless

How best should I "repeat" a 2D platform level with finite width to make it endless?

If I have a scene that's a simple 2D platform, wider than the camera view horizontally, are there any common/accepted best practices to make it "endless" - so that when you reach the furthest right hand side it repeats and you're back at the left? i.e if I knock this together:

platform

And you pass the 6th raised platform, the 1st raised platform will be visible again. So essentially you're playing the same level but could be running endlessly. (I'm sure there's a proper name for this...).

The best results I've found so far are when I manually set the player's position.x coordinate so it essentially shoots back to the left when it hits a threshold on the right, but this means the whole screen has to be clear of things like platforms, enemies, etc so they don't disappear.

I'd also prefer not to make loads of duplicate objects or, if I have to, only temporary ones to help make the effect work - mainly because in my levels there are a finite number of objects that will change as the player continues to pass through and it matters that they only see the same objects on each pass through the level.

Hope that makes sense! Any help on reading or next steps to try would be much appreciated!

screen-shot-2017-07-21-at-214734.png (22.1 kB)
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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Shifty-Geezer · Jul 21, 2017 at 09:08 PM

Duplicate the end parts of the level at the beginning so that when you blip back to the left, it looks the same. If you don't want them visible, mask them (disable) on first start. Alternatively, reposition the objects to the right as the player runs and scroll infinitely. This is what I'm doing with my wrap-around space shooter - when an object gets too far away travelling in one direction, position it on the other side of screen to scroll into view.

Ultimately it depends on how you are creating your level. Infinite runners will be procedurally generated, so you can create blocks at start and hide/show/position as you go. Don't forget it's perfectly acceptable to just move objects off screen (and disable the GameObject)! So create platforms 1-20 at start, then position them at runtime off the right as the player gets near, and disappear them when they're off to the left.

Comment
Add comment · Show 4 · 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
avatar image LeonardChallis · Jul 21, 2017 at 09:12 PM 0
Share

Thanks - definitely some things to think about here. $$anonymous$$y levels will all be static - so the same objects in the exact same positions on every play of the game. Would you suggest a specific solution for that (i.e. reposition versus duplicate)?

avatar image Shifty-Geezer LeonardChallis · Jul 21, 2017 at 10:22 PM 0
Share

Are they repeating? Does it go object 1 - 2 - 3 - 1 - 2 - 3 - 1 - 2 - 3 - 1 - 2 - 3 every play in an infinite loop, or procedurally generated 1 - 2 - 2 - 1 - 3 - 1 - 3 - 2 - 3 - 1 - 3 - 3 - 1 - 2 every play where the level keeps varying as you run? If the former, I'd say create your level and blip the player back to the beginning. That way you can see the level while designing. If the latter, keep the player running right and teleport each obstacle in of screen just ahead of the player as needed, then disable it when it disappears off the left.

avatar image LeonardChallis Shifty-Geezer · Jul 23, 2017 at 01:45 PM 0
Share

Yeah the former. It will be exactly the same. It does seem like blipping the player back to the beginning would be the simplest - it's just making it appear smooth and not having to have a full "blank" screen to do so

Show more comments
avatar image
0

Answer by Getsumi3 · Jul 23, 2017 at 01:48 PM

May be you'll be interested http://pixelnest.io/tutorials/2d-game-unity/table-of-contents/

Comment
Add comment · Show 1 · 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
avatar image LeonardChallis · Jul 23, 2017 at 06:15 PM 0
Share

Which part relates specifically to my question?

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

72 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

Related Questions

How do go about making "Frogger" traffic? 0 Answers

Hit/React Animation 2 Answers

OnTriggerEnter2D(Collider2D other) 2 Answers

Animation Problems 1 Answer

How do I create a good Checkpoint system? 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