• 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 Biendeo · Jul 30, 2010 at 11:54 AM · 2dpickuppower-up

Power-ups for levels?

Hi, I'm making a 2D platformmer, and I'm going quite well. I've made the general game, I can add boxes, moving platforms, and even enemies. However, I also want to put items into my game.


What I'm attempting to do is create a 2D image that will be displayed where the item is. There will be a light effect just underneath it, and when the character collects it, the item will disappear and he will change colour to what item it is.

Currently, I've only thought of a helium item (because the character is a balloon), where the player will rise up. This can be used to get to higher ledges. However, my first problem is how I can get a 2D image into this 3D world.

Once I know that, I'll put the image and the light into a prefab, and then that'll be one object. Thus, if I use a collider script (which I've used for level changes), then I can try to make the object disappear, and the player will change colour.

However, I'm no good at scripting, so can someone make a script that will activate the helium item?

Since there's many variables, I want the item to disappear when the player touches it, the player to change colour (which I've made another texture), and for the player to rise. Also, if you want, can you explain what each action does?


And lastly, since I'm not great at scripting, I'd like to know a great place I can learn scripting in Unity. The website's scripting tutorial is short and doesn't explain much to me, and I can't seem to make any good scripts while looking through the scripting reference. Any help there?

Thanks for the help. :D

Comment
Add comment · Show 2
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 sovalopivia · Jul 30, 2010 at 01:10 PM 0
Share

Nice munchlax ;)

avatar image john 2 · Aug 12, 2010 at 01:45 PM 0
Share

yeah it is a nice munchlax, but typhlosion is better!(use eruption!)xD

2 Replies

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

Answer by sovalopivia · Jul 30, 2010 at 01:32 PM

There are a few methods of implementing 2D sprites (so to speak). One involves getting a package (this one I recommend) but it comes with some extra learning required. The other is by using Planes in Unity.

If you don't know in 3D game development, a Plane is a flat surface, upon which you can attach materials just like your default cube etc.

However to get the transparency right on the Alpha sections of the picture you will need to change the material's Shader value (I find Particles -> Alpha Blended works well) without doing this your sprite will be in a white box, and subject to light sources (meaning he'll probably be quite dark looking without a light nearby)

The other method is by getting the SpriteManager, unfortunately SpriteManager 2 has a license fee (large if you're just learning Unity but for a serious Indie developer it's quite affordable).

Happily the first version that was created is available for free, it's is a handful of classes which are on a Wiki page. Simply copy and pasting each into its own script will enable you to use it's features. For a few instructions on how to use SpriteManager you can look at the Wiki page but also 3DBuzz has a video tutorial, setting up some simple demonstrations using it.


As for floating the balloon upwards that depends on how you're moving your balloon at the moment.

If you are simulating physics using a rigid body and forces, then you can just add an upwards velocity upon picking up the power up.

If not you can hard code in the position going upwards for a few frames; depending on how long you want it to levitate you can use a variable as a counter to change the duration and distance, and only apply the change whilst the counter is > 0.

For a more detailed answer I suggest asking this question seaprately. :)


And finally there are plenty of poeple who have asked for tutorials and resources here already, check those questions out. But here are some of the things I used.

Most importantly the Scripting Reference.

  • http://unity3d.com/support/documentation/ScriptReference/index.html

Some youtube video tutorials

  • http://www.youtube.com/user/TornadoTwins
  • http://www.youtube.com/user/steamisM50#p/c/B4A9AF3016913F2E
  • http://www.youtube.com/user/cannedmushrooms#grid/user/38D79E57A640D733
  • http://www.youtube.com/user/cannedmushrooms#g/c/68B1CD06C9BFD54A
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 Biendeo · Sep 22, 2010 at 11:37 PM 0
Share

I decided to not be lazy and spent 30 minutes modelling what I wanted. I have learnt pretty much the basics of using Blender now, and I was able to make something decent. Thanks for the advice though. :D

avatar image
0

Answer by Ares · Jul 30, 2010 at 01:38 PM

For help on creating the script, you'll probably want to check out the forums. http://forum.unity3d.com/index.php For the most part, this area is for more specific questions.

As far as the 2D on 3D. I don't know what most newer programmers call that, but back in the day, we called it 'billboarding' (you might need that term to help get your point across). Basically faking a 3D object and having it always facing the camera.

~Ares

edit::I see sovalopivia got here before me with a lot more info.

Comment
Add comment · Show 2 · 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 sovalopivia · Jul 30, 2010 at 01:45 PM 2
Share

Sovalopivia used Quick Attack!

avatar image e.bonneville · Jul 30, 2010 at 03:07 PM 0
Share

@sovalopivia. Wise choice. Quick Attack has a 98% chance of success.

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

how do i make this advance fire system for my player!!! 1 Answer

2D UFO Tutorial, UFO turns invisble after 6th pickup? 1 Answer

Assets/Scripts/PlayerController.cs(32,49): error CS0126: An object of a type convertible to `float' is required for the return statement 1 Answer

Play Sound on Destroy 1 Answer

Play Sound on Destroy 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