Ball "stuck" bouncing repeatedly against patform

jbsj207jbsj207 Member Posts: 21
edited November -1 in Working with GS (Mac)
I have about 6 actors in my new project (some walls, a ball (which i eventually want to spawn multiple balls according to time or score) and a small platform. I got the ball to bounce when it hits the platform, but after a few times of pressing my left and right buttons to move the platform, when the ball reaches the platform, it seems stuck bouncing against only the very top of the actor platform... i will try and post a video of what i am talking about. Thanks for your help.

Comments

  • jbsj207jbsj207 Member Posts: 21
    heres the video. hopefully i can explain it better.



    as u can see, at bout 29 seconds in the video, the ball will bounce along the platform and if i stop the platform the ball will 'bounce in place' along the platform.
    Help?
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
  • jbsj207jbsj207 Member Posts: 21
    works for me.. even after signing out... hm. weird. :/
  • jbsj207jbsj207 Member Posts: 21
    Yep. It should work now. double-checked the sharing and embedding setting.. *sigh*
  • jbsj207jbsj207 Member Posts: 21
    anybody?
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    It looks like a case of 'tunneling'. This can happen if a rule is changing the direction of the actor due to a collision. Its often caused by an actor tunneling in too deep into a platform during the collision. Then when the rule says to change the direction it does not clear the boundaries of the platform (its too deep into the platform) before the rule to change direction fires again. So... while it is still tunneled into the object, it keeps changing direction back and forth.

    One way to fix this -- In the collision rule, constrain the ball's Y attribute to move up above the platform a little more. Then have it change direction.
  • jbsj207jbsj207 Member Posts: 21
    Thank you, RThurman :)
    do you mean put the 'collide' inside the rule option? cause i think the way its a few rules then collide by itself. and then would i just do 'constrain attribute' to a specific postion? correct?

    that reminds me, is there a way within the scene to find X and Y inside the preview? like for example in photoshop there is show grid option. is that possible?
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    It really depends on how you have the rules set-up. Can you tell a little more about the way you are getting the ball to bounce?

    As for the second question -- I don't think there is a way to automatically show the x and y of an actor. But you could put a display text behavior into an actor. Then you can tell the behavior to display the x and y coordinates (or any other attributes) of the moving actor. In the display text behavior, use the expression editor to replace "Hello World!" with: (self.Position.X) ..(self.Position.Y)
  • jbsj207jbsj207 Member Posts: 21
    i dont remember how i got the ball to stop "tunneling" but here are screen shots of the ball actor's rules

    http://tinypic.com/r/25j82mw/7
    http://tinypic.com/r/2ikcvpy/7

    now, i want the ball to go in random directions when it collides against the walls, kinda like it will shoot up from the platform to the walls and then go in a random direction, thus making it more difficult for the player to "catch" the ball..because my game u have to keep the ball at least in the air or on the paddle, or its game over.... but i tried everything i could think of including setting up different actors for horizontal and vertical walls...but i cant get it to work :/ I apperciate your guys' help. im such a n00b but i hope to have my game complete the end of August. thanks again.

    ** edit: btw the collide rule that is collapsed, is just a rule that when the ball hits the paddle, it plays my custom sound effect, and that is working 100% :D
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    Glad you got the ball unstuck! Did you slow down the speed?

    To get the ball to bounce in a random direction you can check to see it it is colliding with an object and then set its velocity to a random number. So in your first pic, in your "when overlaps or collides with actor of type vertical wall" rule, add a "change velocity" behavior. Use the expression editor to set the velocity to a random number between 90 and 270 (since the ball is colliding with a vertical wall).
  • jbsj207jbsj207 Member Posts: 21
    90 and 270, huh? i saw many tutorials using 0,360 and thats what i tried and didnt work very good. anyways today i accomplished a lot on my game. added a game over screen and sound effects and some background music... hmm but the music would stop when the sound effect played, almost like the sound effect rule 'took over' the music rule. (if that makes any sense, lol) so i eventually just deleted the sound effect and kept the music. but i think both music and sound effects would add to the game players exprience. but thanks! i appericate all ur help. this is my first game and im really excited to be working on it. id say its about 75-80 percent done. i dont have the paid developer account yet so i cant test the game on my iPhone. *sigh*
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    Actually the random(90,270) thing would be for the right vertical wall. Zero angle is straight to the right, 90 is straight up and 270 is straight down. So you want a random angle that will bounce the ball to the left (something between 90 and 270).

    You would need to do the same kind of thing for the top wall -- random(180,360), and the bottom wall (er... floor) -- random(0,180)

    I don't know about sound effect rules. I hear on these forums that sound needs some fixes in the next version.

    Good luck with your first game! It sounds like its coming along nicely.
Sign In or Register to comment.