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 /
avatar image
0
Question by Nova-1504 · Oct 12, 2016 at 06:03 AM · 2dgravityplatformsladder

2D game building

I want to make my 2D game side view so that in a mansion, there are rooms above (climb with ladders), below (more ladders) and to either side of the rooms with an end to the mansion after approximately 7 rooms in each direction. However, I have no clue how to make the gravity and platforms work. I'm probably overthinking it. Need quite a bit of help!

Comment
Add comment · Show 1
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 Nova-1504 · Oct 12, 2016 at 09:29 PM 0
Share

UPDATE Still stuck. thinking something to do with it being just a platformer with a different background. No clue how to do that either. Still clueless about the gravity.

3 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by DudeBrainz · Oct 13, 2016 at 06:59 AM

well i'm not good with unity, but i believe you could use a rigidbody and freeze it's x and y when you "climb" your ladder, and just manually manipulate the position. there are plenty of tutorials on the rest of a 2d controller. if by platforms you meant moving platforms, then just

 OnCollisionEnter(Collider 2D WhateverYouWantToNameIt) {
              if (WhateverYouWantToNameIt.tag == "your moving platform tag")//(casesensitive)
                           //do stuff to add the x&y movements of the platform to you
              }
 
 }




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
avatar image
0

Answer by b1gry4n · Oct 13, 2016 at 02:19 AM

You are working in 2d, so dont forget that. Whether it is top down, side scrolling, etc...it is still 2d space. This means that the rooms on the sides/above/below could just as easily be walls surrounding a room from a top down view. The art would be the visual cue that we are playing a sidescroller rather than a top down.

You could use a rigidbody for gravity, or you can simulate your own for more control (though gravity is a pretty universal thing)

To simulate gravity, just apply a force in the direction you want the gravity to take effect. Cast a ray from the players position "down". Use colliders on a ground layer of your choice. If a ray of a certain length (usually a length that ends a tiny bit below the characters feet) hits the ground collider, you are grounded. If not, apply the simulated gravity force.

I havent done a lot of 2d work inside unity, but I do know that unity has a whole collection of tools available for 2d games.

https://unity3d.com/learn/tutorials/topics/2d-game-creation/rigidbody-2d?playlist=17093 https://docs.unity3d.com/ScriptReference/Physics2D.Raycast.html https://unity3d.com/learn/tutorials/topics/2d-game-creation/collider-2d

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
avatar image
0

Answer by MerlinsMaster · Oct 13, 2016 at 02:50 AM

This video will show you the way most people doing 2D sidescrollers handle moving platforms:

https://www.youtube.com/watch?v=HMZnSZswTmU∈dex=23&list=PLiyfvmtjWC_Up8XNvM3OSqgbJoMQgHkVz

The series this video is a part of is pretty good if you're just trying this kind of thing out for the first time.

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

6 People are following this question.

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

Related Questions

How to turn off gravity? 4 Answers

Horizontal attraction? 0 Answers

2d planetary gravity 3 Answers

Is it possible to have a vehicle stick to a platform when it flips? 1 Answer

Have rigid body enter a planets orbit but always be able to escape it 1 Answer


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