spawn new ball

wongj19wongj19 Member Posts: 45

How can I make it so that when my ball is moved off it's starting position, a new ball spawns.

Also how can I make my game so that gravity doesn't affect the ball until it is moved off the starting position.

Any help appreciated.

Comments

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited April 2016

    Depends on your controls? How are you grabbing the ball. Can you slam dunk? Remember everything is logic with code. Things do what you tell it to do when. These two videos should give you some ideas.

    As to your main questions an easy way would be to have an invisible actor where the ball starts. From that actor you can track and spawn a new ball.

    So in invisable actor

    Rule

    When overlaps and collides with ball

    In the otherwise section

    Spawn ball

    Position X 0 Position Y 0 related to actor.

  • wongj19wongj19 Member Posts: 45

    @Lost_Oasis_Games said:
    So in invisable actor

    Rule

    When overlaps and collides with ball

    In the otherwise section

    Spawn ball

    Position X 0 Position Y 0 related to actor.

    Thanks, I never thought about this :)

    @Lost_Oasis_Games said:
    Depends on your controls? How are you grabbing the ball. Can you slam dunk?

    Yes you would be able to slam dunk by grabbing the ball. Does this information help in coming up with a solution for the ball to not move until it is flicked? (Gravity doesn't affect the ball until flicked for the first time) if you can help, pls reply

  • IceboxIcebox Member Posts: 1,485

    @wongj19 said:
    Does this information help in coming up with a solution for the ball to not move until it is flicked? (Gravity doesn't affect the ball until flicked for the first time) if you can help, pls reply

    @wongj19 Hey , I attached a demo not sure if this is what your looking for.

    Hope it helps

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    @Icebox -- great demo. You are on fire this week!

  • IceboxIcebox Member Posts: 1,485

    @RThurman Thanks :) !

  • wongj19wongj19 Member Posts: 45

    @Icebox said:
    @wongj19 Hey , I attached a demo not sure if this is what your looking for.

    This is a really nice demo, but sadly I was looking more of a flick gesture to move the ball. If u have time could you please make another demo as this would really help me. Thanks

  • wongj19wongj19 Member Posts: 45

    @Lost_Oasis_Games said:
    So in invisable actor

    Rule

    When overlaps and collides with ball

    In the otherwise section

    Spawn ball

    Position X 0 Position Y 0 related to actor.

    I tried this but is just spawns 2 balls. It also lags the apps so that I can't flick the ball anymore. Is there another way to do this?

  • wongj19wongj19 Member Posts: 45
    edited April 2016

    This is what I'm doing at the moment. @Lost_Oasis_Games

    Image and video hosting by TinyPic

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    . Also add a timer to the spawn, like after .5 or whatever pace of time you want. Set the spawn to 0x-0Y and relative to actor. Show me your flick rules.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited April 2016

    Try this. Here is a proper flick throw with a basic spawn mechanic.

  • wongj19wongj19 Member Posts: 45
    edited April 2016

    Image and video hosting by TinyPic

    heres my coding for throwing the ball that I copied off youtube. Which way should I use yours or mine. @Lost_Oasis_Games

    I also made my game so that if the ball bounces on the walls of the screen more than 6 times, the ball disappears. How can I make my counter different for every ball? Heres the coding that i have at the moment. (not very good as I made it myself)

    Image and video hosting by TinyPic

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited April 2016

    Okay so a counter for each ball should be done with a self attribute.

    In prototype actor of ball make a self integer. Bounce_Count

    Now just replace self.bounce_count with your game.ball bounce attribute in the code you showed.

    Your code for throw looks fine other than you don't need to do those change attributes for touch X and Y. No need for those.

  • KevinCrossKevinCross London, UKMember Posts: 1,894

    @IceBox @Lost_Oasis_Games can I ask what programs you use to capture your screen and save to gif please?

  • IceboxIcebox Member Posts: 1,485
    edited April 2016

    @KevinCross i record a video with quicktime and type in google 'video to gif' and choose the first link . u upload the video on their site and it turns it to gif save it and upload it here. i dont know if its ok i put a direct link here

  • KevinCrossKevinCross London, UKMember Posts: 1,894

    @Icebox said:
    @KevinCross i record a video with quicktime and type in google 'video to gif' and choose the first link . u upload the video on their site and it turns it to gif save it and upload it here. i dont know if its ok i put a direct link here

    Ok thanks. I thought there might have been a program that did it in one or two simple clips.

  • SocksSocks London, UK.Member Posts: 12,822
    edited April 2016

Sign In or Register to comment.