Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Sprite Collision blues

Author
Message
wickedly kick it
18
Years of Service
User Offline
Joined: 13th Jul 2006
Location: Fort-worth Texas
Posted: 2nd Aug 2009 07:38 Edited at: 2nd Aug 2009 08:04
im making a pong game, and heres the function that wont work, 3 is the ball, 1 and 2 are the paddles.


is it something real simple im missing?
edit:
fixed the doubling issue still wont bounce back
okay fixed another mixup, still wont bounce

fixed the bouncing, now it bounces only a certain way ><

Bubzy
15
Years of Service
User Offline
Joined: 29th Jun 2009
Location: somewhere
Posted: 2nd Aug 2009 10:57
im no expert on this as i havent even attempted to do it yet but there are things called "reflection vectors" or something. they workout how the "ball" hit the "paddle" and calculate the reflection angle. it might be worth hunting down sparky's collision mod for dark gdk as im pretty sure this stuff is handled very well in that. Hope this helps.

void Void(void){(for i = 0; i < i+1; i++){cout<<"bubzy rules "};}
Phosphoer
16
Years of Service
User Offline
Joined: 8th Dec 2007
Location: Seattle
Posted: 2nd Aug 2009 11:33
If your paddle isn't going to be rotating, you can simulate the physics very easily by having a MoveX and a MoveY attribute of your ball, which describe how much it's moving in the x and y direction.

Then when the ball hits a paddle, just multiple MoveY by -1. Or you could multiply it by -1.1 to make the ball speed up each time it hits a paddle ^^.

wickedly kick it
18
Years of Service
User Offline
Joined: 13th Jul 2006
Location: Fort-worth Texas
Posted: 2nd Aug 2009 11:59
in my galaxy pong game, i did the same thing and it worked fine! i need to look that source back up i suppose and double check

Caleb1994
15
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 4th Aug 2009 01:18
I would suggest creating your own collision routine. lol

New Site! Check it out \/

Login to post a reply

Server time is: 2024-10-01 08:49:04
Your offset time is: 2024-10-01 08:49:04