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 Kh_Shoukry · Apr 26, 2018 at 08:53 PM · 2d-platformerturretmario

Mario-Like 2D platformer (Bill Blaster)

I'm doing a school project to make a game like super mario bros on unity3d using design patterns, and i'm making the bill blaster. i already made it instantiate the bill bullets but i don't know how do i make the bullet blaster detect on which side is the player so it will shot the bullets that way.

this is what i've done so far

 public class Bill_Blaster_Demo : MonoBehaviour {
     public Transform BB_Spwan; // Where the bullet gets instantiated from
     public EnemyManager em;
     public GameObject bb; //the Bullet Bill
     float spawnWait = 2.5f;
     float destroyWait = 10f;
     IEnemies Bill_blaster;
     
 
     void Start ()
     {
         Bill_blaster = em.GetEnemy(gameObject.tag);
         Bill_Blaster.setTransform(BB_Spwan);
         StartCoroutine(Spawn());
     }
     
     IEnumerator Spawn()
     {
         while (true)
         {
             Bill_blaster.Move(bb);
             yield return new WaitForSeconds(spawnWait);
             
         }
     }
 }

 
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
1

Answer by ZuhairGhias · Apr 27, 2018 at 07:26 AM

Have you tried comparing the position.x of the player with the position.x of the bill blaster? You could add an if statement that checks for this in the Spawn() method.

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
1

Answer by JxWolfe · Apr 27, 2018 at 12:18 PM

It sounds like unity's demo for a jumpman shooter at

https://www.assetstore.unity3d.com/en/#!/content/11228

You could either look at their code, or change their code to fit your needs. There isn't a demo for this so you might want to look at the much more complicated unity demo that has a tutorial here:

https://www.assetstore.unity3d.com/en/#!/content/107098

tutorial:

https://unity3d.com/learn/tutorials/s/2d-game-kit

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

87 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

Related Questions

Mario like skid when moving in oppsite direction for 2d platformer 0 Answers

making an object stop responding with an object at a certain distance away 1 Answer

My turret is a pacifist. 2 Answers

Turret rotation angle 1 Answer

turning on x and y axis for turret but not using lookat? 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