Im working on a pinball game in TGF right now, and the ball sometimes goes through the flippers or ramps. Anyone have any ideas as to why this could be happening.
Well, the flippers have 3 animations; stopped, walking, and running. Stopped ia in the down position, and the ball isnt passing through when stop is playing (looping). Walking is when its rotating up, and running is when it's in the up position (looping).
I modified the bouncing ball movement since theres no pinball movement in TGF. Here are the conditions with the flippers (only left flipper):
Upon pressing left:
-Change animation to walking
Animation Walking is over
Repeat while left arrow is pressed
-Change animation to running
(Negated)Repeat while left arrow is pressed
-Change animation to stopped
Animation walking is playing
Ball collides with flipper
-Bounce Ball
-Set speed of ball to (Speed of ball + 20)
Animation running is playing
Collision between ball and flipper
-Bounce Ball
Only once when event loops
Animation stopped is playing
Collision between ball and flipper
-Set speed of ball to (speed of ball - 20)
-Set direction of ball to 31 (Rolls down flipper)
specific enough!
hmmm, im not familiar with TGF but it may have somthing to do with the built in movement, The ball movement is extremly buggy and if you mix that with collision whilst animating, that could be the problem.
from what you have written there its should work but i would seriously suggest leaving the ball movement and try creating a custom movement that doesnt allow this to happen, especially for a pinball game.
The major problem with the built in movements is the unexpected outcome of certain situations.
Sorry i couldnt nail the actual problem, if anyone has a better explenation, listen to them.
I think it happens when the flipper is animated. Cause then the flipper might just "jump" over the ball. Depends on how many animation frames you use though.
Theres 5 frames in the walking animation, and each one rotates by one point, so I don't see how that would be the problem. And also, sometimes it goes through the flipper while its in the up position.
@Kjarom - Wouldnt I use the collision markers on the flippers (not the ball)?
@LegendKprDos - I need pinball because it goes with all of the other games in this game, but pachinko would be a little boring anyways?
@Antworx - Youre probably right about the ball movement, but if Id have to create a whole physics engine to make a custom movement for pinball =/.
Well, in the long run it'd be easier just to make them for the ball; the ball is going to be bouncing off of many other things besides the flipper, and collision markers just make any game smoother.
But hey, put 'em on the flippers too. Doing so will probably eliminate your glitch.