Best Collision method for bat and ball
Tim_A
Member, PRO Posts: 60
Hi all,
just wondering what collision approach you would take for an overhead baseball-style game?
I have a ball actor travelling along the Y-axis towards a batter.
The plan is that when an on-screen button is pressed, the batter swings and hits the ball. The ball object will then move along a chosen path off the screen.
I'm not planning on adding any real physics, just a collision event.
Would monitoring the balls Y position as an attribute, and then saying 'if button down, and ballY >400 <420' work?
Or is there an easy way to add real physics to the batting action so that the balls can be hit left/right depending on timing?
Thanks for any help
Tim
Comments
@Tim_A, have a look through these two threads, they relate to a pinball flipper but try to achieve the same as you.
http://forums.gamesalad.com/discussion/comment/398066#Comment_398066
http://forums.gamesalad.com/discussion/comment/422276#Comment_422276
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
Thanks for that, looks pretty comprehensive and probably a bit too complex for what i need at the moment. I've saved the demo files for another project
Basically, i'd like to know the most efficient way to create a 'timing' based game, so that when the ball is in a certain position, clicking a button will send it in another direction.
At present the ball is spawning and travelling up the screen. When it gets in front of the player in a certain area, clicking a button will cause the ball to travel off like it has been struck.
I'm conscious of frame rates etc. so not sure whether to go for a Y=>420 but <430 approach, or perhaps have a hidden actor that is triggered by a button press?
Again thanks for any advice
Tim