Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

17 Neutral

About ethancodes

  • Rank

Personal Information

  • Role
  • Interests

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. ethancodes

    Making an interactive hud

    I stepped away from this for awhile to get a different part of the game taken care of. I'm back on this now and I found this: https://unity3d.com/learn/tutorials/topics/user-interface-ui/ui-slider I'm wondering if there is a way to make a custom UI element similar to the slider, but shaped differently.
  2. ethancodes

    Making an interactive hud

    @1024 The line is like a slider, and the arrow slides along the slider, always staying perpendicular to it. So when the arrow is at the far left, and the screen is release, the ball will shoot in the direction the arrow is pointing. So towards the right side of the screen.
  3. ethancodes

    Making an interactive hud

    Orthographic. And technically the top arrow won't be there? that's just the direction the ball will go when shot. Think of it like pool. The ball is the cue ball and the arrow is the stick. You rotate around the ball at different angles to make it go different directions. Same thing here.
  4. ethancodes

    Making an interactive hud

    For the most part, yes.
  5. So I'm making a power up where the ball on the screen will hit a paddle and stop there, a hud element will pop up giving the player control to aim the ball's direction, and then the ball will launch when the hud element is released. I've never done anything like this before, the most I've done is simple health bars or menu's, and I'm having a hard time finding any info on how to do something like this. I've put an image below to show what I'm trying to do. If the arrow on the bottom is slide to the left or right, the arrow at the top indicating the direction the ball will launch will move accordingly. Any ideas on where to even start with this?
  6. Oooh I see. Alright I'll give it a shot! Thanks!
  7. Not entirely sure that will work as this is a 2D game, and all the balls spawning are basically identical so I'm not sure how I could put them on different layers as they are spawned and destroyed and new ones are spawned all the time.
  8. I'm working on spawning several balls in the same location and shooting them all outward randomly within a certain angle. I need to know how I can spawn the balls in the same spot though without them hitting each other. I need them to hit everything else except other balls. Is there a way to do this?
  9. I got it! Someone on stackoverflow pointed out that I was not actually accessing the instance of the newBall, but rather the prefab. So I put var ball = Instantiate blah blah blah and that fixed it. Thanks for the help!
  10. Scratch that, it is in fact getting the vector from the original ball, but for whatever reason, it is not launching the ball when it is handed the vector. I'm really not sure why this would be. Everything looks right to me.
  11. Yes i do need gravity. I have not tried that... I'll give it a shot real quick. Ok that did not work, but let me backtrack a little bit. I could have sworn when I checked before I was getting the vector of "mainBall", but maybe I was mistaken cause I just checked it again and it's all 0's. This is the code for grabbing the vector from mainBall: mainBallVector = mainBall.GetComponent<Rigidbody2D>().velocity; Am I missing something here as to why it would not be grabbing the info from this?
  12. Tried this, but I'm getting the same result.
  13. I've got a bunch of balls all spawning in a timed interval and I am setting the velocity of them when they spawn so that they will spawn and immediately start going in the direction I want. However, they don't do that. Instead they spawn in place and gravity makes them begin to fall straight down. if they hit something, then they take off like just like they should have spawned. I'm not sure why they have to hit something for this to happen. Any ideas? The code below is the ball spawning code. The mainballVector is set in a different section and I have verified it does have the correct values. Instantiate(newBall, new Vector3(paddle.transform.position.x, (paddle.transform.position.y + 1), 0), Quaternion.identity); newBall.GetComponent<Ball>().hasStarted = true; GameManager.pickUpManager.allBalls.Add(newBall.GetComponent<Ball>()); newBall.GetComponent<Rigidbody2D>().velocity = mainBallVector; //use the original ball's vector3 to follow it directly
  14. ethancodes

    problem with a coroutine

    I think I was thinking incorrectly, after reading your post I realized that putting the whole loop in the coroutine may actually fix the issue IF I put the stuff that is already in the coroutine inside the loop. The way I was first thinking about it was to have the timer, followed by the loop, in which case the timer would only be called once. Now it makes sense! I'll give it a shot!
  15. ethancodes

    problem with a coroutine

    The method is called by an event, the event is called by a ball colliding with the paddle, so yes OnCollisionEnter2D. As for putting the loop inside the coroutine, I don't believe that would work. I need to spawn ball, wait, spawn ball, wait, spawn ball, wait, etc. But if the loop is inside the coroutine it is going to wait...spawn ball, spawn ball, spawn ball, etc. I suppose I can possibly try a boolean like you suggest, but also like you said I'm not sure that will work or that it's a good idea. Are there any alternatives to coroutines that would work as a timer that I could use in this situation? I'm open to other ways of doing this. I tried using a timer of some sort previously but it of course stopped everything else in the game while the timer was counting which won't work for what I need.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!