Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Once more :collision  (Read 2892 times)

0 Members and 1 Guest are viewing this topic.


  • Full Member
  • ***
  • Posts: 148
    • View Profile
Once more :collision
« on: September 18, 2008, 10:39:34 pm »
ok there is my pong clone and finally it seems to work, but theres one thing id like to have checked:

when my ball comes down and it hits the bat it should go back;
my ball moves with the increasing speed move_y :

Ball.Move(movex * App.GetFrameTime(), movey * App.GetFrameTime());

now i wanna see if it would hit the bat i did it like that:

Code: [Select]

if((ballvec.y + movey * App.GetFrameTime() >= 540) && (ballvec.x +10 >= shapevec.x) && (ballvec.x <= shapevec.x +150) && ingame)

important for me is the first part  :
f((ballvec.y + movey * App.GetFrameTime() >= 540)
( at 550 my bat starts and the ball has 10 pix for that reason theres 540)

now will my ball hit the bat or with icreasing movey turn around too early?

sry for english