• 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
1
Question by Firetrain · Jul 06, 2018 at 02:38 PM · 2d2d game2d-platformer2d-physics2d sprites

Help Me! I want to make a pixel fairy!

Hello! I am making a 2d platformer like game. The game starts in a dark cave with overworld light decreased. The player is with a 1 pixel size fairy. THE PROBLEM- 1. I want that fairy to glow and produce light moving in all directions. But I don't know how to give light like effects to game objects. 2. I want an AI script for the fairy so that she will always hover near me like an ally. 3. The cave is divided into two because of a wall. I want one side of the cave dark and the other a little bright because of a cave entrance. Can this be done? Will a directional light collide to the wall? Will the wall prevent the lighting to reach the other side of the cave? If no, is there another way? Pls HELP!!!

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
Best Answer

Answer by TheKnightsofUnity · Jul 06, 2018 at 04:50 PM

Hey @Firetrain !

  1. Right click on your fairy GameObject -> Light -> Point Light. That should create a new child object with Light component. For a glow effect I'd advise looking for an asset on the Unity Asset Store.

  2. A simple way to achieve this would be to add a new child to your player object that would contain only a Transform component and place it somewhere besides your character. Then add a new script for controlling your fairy and attach it to the Fairy game object. Edit the script and write something along these lines:

public class FairyController : MonoBehaviour { [SerializeField] private Transform targetSpot; [SerializeField] private float moveSpeed; private void Update() { transform.position = Vector3.Lerp(transform.position, targetSpot.position, Time.deltaTime * moveSpeed); } }

Now you can drag'n'drop the player's child object to targetSpot field and experiment with moveSpeed value until you're content with how it works.

3.If you use point lights and the wall object and its material are properly set it should work as you want it to work. Try it out in editor and go back here if you have some problems with it.


Hope that helped :)

Cheers!

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 TheKnightsofUnity · Jul 06, 2018 at 05:04 PM 0
Share

Can't get the code markdown to work so here's a link to the same code with clearer formatting: https://paste.ofcode.org/Zp5W26E6TeGuwe7FXzBQia

avatar image Firetrain · Jul 07, 2018 at 01:07 AM 0
Share

Thanks! I will try it out and tell you if any problem arises. So please keep looking into the question. I will tell you if all of it worked. THAN$$anonymous$$S AGAIN!!

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

188 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

Related Questions

simulate gravity in a 2D game 3 Answers

2D Sprite Fillup without using UI 1 Answer

How to check if an object hits the ground hard enough then add explosive force around it (2D) 1 Answer

Instantiate a GameObject with a specific Z rotation 2 Answers

Can anybody help me with this? Character bodying is falling apart. 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges