Ball deflecting walls like arkanoid or brick game
BlitzMax Forums/BlitzMax Programming/Ball deflecting walls like arkanoid or brick game
| ||
id like to make a ball deflect and move around a 800,600 screen. im using sprite candy how can i do a 2d version but for blitz3d +sprite candy , or just blitz3d if you dont have sprite candy |
| ||
Ahm, I think this is in the wrong forum BMX <-> B3D! For BMX: There is a breakout sample that ships with the full version of it. |
| ||
simply reverse the X, Y speeds when the ball hits something and use a sin/cos calculation when it hits the bat to work out the angle it should bounce off. |
| ||
Or calculate the cross product between the velocity vector and the collision normal, and use it as the new velocity vector. |
| ||
Dir=360-Dir works for me if your using direction |
| ||
@mike, are you sure? A cross product between any two vectors in two dimensional space (which this is) will result in a vector comming out of the page. |
| ||
oerp, good call, my bad :) |