Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
1
Question by Otis · Dec 29, 2011 at 09:29 AM · bulletfirepatternhell

2D Bullet Hell Game - Bullet Patterns

Hello Im creating a 2d bullet hell game from the top down view in unity and Im having a bit of a problem I dont know how to make certain patterns. Heres a video of something similar that Im trying to recreate http://youtu.be/jeU9ff6KAXQ

@2:20 thats the type of bullet movement that I want to recreate I know how to do all the other types except that one so if anyone could help me write a script for that type of movement It would be vary much appreciated! Im using JavaScript also

Ive also come across this page I think this is what Im looking for but I dont know how to apply it Firing a curtain of bullets Thanks in advance!

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
3

Answer by CHPedersen · Dec 29, 2011 at 11:35 AM

People probably won't write a whole script for you, but your question can be relatively easily answered insofar as the necessary math is concerned. :)

Take a look at the video clip you posted again and this time, pay attention to just one single bullet. Do you see how it's not actually changing direction? Every bullet just follows a straight line after getting fired. It's the 7 emitters (cannons or whatever) that rotate a little bit back and forth around a common point in the center of the enemy, and since they're constantly emitting bullets while rotating, the bullets appear to follow that "flower"-pattern you see.

Position the emitters in a circular pattern around the enemy's center and find a way to mimic the rotation, and your bullets will behave the same.

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 Otis · Dec 29, 2011 at 12:12 PM 0
Share

Wow thank you I see how it works now I feel so stupid that I did not see it before, So all I would have to do is rotate the emitter around its y axis a certain number of degrees every couple of seconds so depending on the degree and the time of the rotation influences the shape of the pattern? Is that correct?

avatar image CHPedersen · Dec 29, 2011 at 12:44 PM 0
Share

That is exactly correct. It's like the kind of fireworks where multiple spark-fountains are attached to a wheel, and you nail the wheel to a wall or a tree, and it rotates when you light them, you know? Sort of like the one in this image:

http://farm4.static.flickr.com/3154/2678082574_8a9a75d1a8.jpg

The sparks behave exactly like you want your bullets to do - They're shot straight out, but look like a spiral because the fountains rotate, and so move a little bit every time a new spark gets emitted.

avatar image
2

Answer by ImpusNatus · Dec 29, 2011 at 12:29 PM

Something like this might work?

It's only setup to modify, oscillate, on x. Easy to apply to the other channels.

 using UnityEngine;
 using System.Collections;
 
 public class ObjectOscillator : MonoBehaviour {
     
     public float speedMult = 1.0f;
     public float rangeMult = 1.0f;
     // Use this for initialization
     public GameObject bullet;
     public float shootInterval = 1.0f;
     float basex = 0.0f;
     float shootTimeAc = 0.0f;
     // Update is called once per frame
     void Start() {
         basex = transform.position.x;
     }
     void Update () {
         Vector3 position = transform.position;
         float interval = Mathf.Sin(Time.time * (speedMult / rangeMult)) * rangeMult;
         bool shoot = false;
         if(Time.deltaTime + shootTimeAc > shootInterval)
         {
             shootTimeAc = 0.0f;
             shoot = true;
         }
             
         else
             shootTimeAc += Time.deltaTime;
         
         position.x = basex + interval;
         
         transform.position = position;
         if(shoot)
             Instantiate(bullet, transform.position, bullet.transform.rotation);
     }
 }
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

7 People are following this question.

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

Related Questions

Make a Gun fire multiple times 3 Answers

Object pool shooting not working 0 Answers

Player bullet is fired but spawns ahead of the player character in Unity. 1 Answer

shot delay in between bullets 1 Answer

Spreading Fire (Bullets) 3 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