beccatigger Posted June 1, 2006 Share Posted June 1, 2006 (edited) [sorry can you move my post to programming....apologies]Hi Guys,I'm working on a stupid uni project which I am totally stuck on and I've been going over and over and now I've got to the point where I've basically got to hand it in and I really need some help.Basically I've got to make a ball bounce around off some fixed walls and we HAVE to use collision trees. (I mean don't even get me started on how stupid that is) The ball has to move at a constant speed, bounce off the walls and then keep moving post-collisionAll I can do is get the ball to move.....thats it.I'd be really grateful for ANY help you can give me, can't find this ANYWHERE and you guys have always been so good helping me out in the past.......I just feel so dumb for not being able to do thisHere's what I got so far:for(int i = 0; i <=3; i++) { if(ballx >= rootNode.child.xstart && bally >= rootNode.child.ystart && ballx <= rootNode.child.xend && bally <= rootNode.child.yend) { System.out.println("ball found in sector"+rootNode.child.name); } if (rootNode.child.name=="A") { for(int a = 0; a <=3; a++){ if (ballx >= rootNode.child[0].child[a].xstart && bally >= rootNode.child[0].child[a].ystart && ballx <= rootNode.child[0].child[a].xend && bally <= rootNode.child[0].child[a].yend) { System.out.println("ball found in sector"+rootNode.child[0].child[a].name); } } } else if(rootNode.child.name=="B") { for(int a = 0; a <=3; a++){ if (ballx >= rootNode.child[0].child[a].xstart && bally >= rootNode.child[0].child[a].ystart && ballx <= rootNode.child[0].child[a].xend && bally <= rootNode.child[0].child[a].yend) { System.out.println("ball found in sector"+rootNode.child[0].child[a].name); } } } } I urgently and eagerly await your help!!!!! Thanks Becs Edited June 1, 2006 by beccatigger Link to comment Share on other sites More sharing options...
beccatigger Posted June 3, 2006 Author Share Posted June 3, 2006 anyone? Link to comment Share on other sites More sharing options...
MMx Posted June 20, 2006 Share Posted June 20, 2006 (edited) I created a javascript game once that had a few of these functions you require.Leave a message if you want to take a look at the source, but remember is Jscript, not Java. Edited June 20, 2006 by MMx Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now