Still working on Pong. Harder than I thought, great learning experience though. :-)
I have a
ball which is a
RigidBody2D. It bounces around nicely.
I have some
bats. They are
KinematicBody2D. They are controlled nicely now with keyboard, mouse and touch. So far so good.
I also have two
walls and the ball bounces nicely off the wall. The bat also stops when it hits the wall. The whole thing is just smooth as silk. The days are looking bright!
Here's an example of each:
They work nicely. I'm happy.
So now, within the
bat, I'm trying to determine what we're hitting (wall or ball) and then soon, where.
This is my code:
#let's see if the ball hit the bat
if bat.PlayerNumber == 1:
print("collision event captain!")
print("colided with: ", str(bat.get_collider()))
bat hits wall. All strings display including the collision object
bat hits ball. Nothing is displayed. No
collision event captain! or anything after.
It has to be a beginner mistake. Can anyone spot what it could be?
The bat will not go through the wall. The ball bounces off the bat. It's all working well. Just no collider info is returned.
Any advice will be lapped up. :-)