![]() |
| |||||||
| Home | Forums | Rules | All Albums | Blogs | Donate | Subscriptions | Register | Mark Forums Read | vBExperience |
| Software & OSs Operating Systems, Anti-Virus, Utilities and Programs. |
![]() |
| | LinkBack | Thread Tools |
| | #1 | ||||||||||||||
| wow.... so many letters..
Join Date: Mar 2007 Location: batemans bay, australia
Posts: 94
| hey, i'm currently doin my yr12 hsc and need help to code a program, im making pong using vb.net and was wondering how to get the "ball" to bounce off the "paddle", iv got the ball to bounce around the feild, but just not off the 2 paddles. i also need help to get the paddles to stop moving when they hit the edge of the feild, any help appreciated. by the way, i'm a bit of a ****** wen it comes to coding ![]() | ||||||||||||||
| | | ||||||||||||||
| | #2 | ||||||||||||||
| Modder-ator
| I know a bit of VB, but not that much! I've never gone much past just input boxes, user forms, etc. Sorry! Hopefully someone else will be able to help you out though... | ||||||||||||||
| | | ||||||||||||||
| | #3 | ||||||||||||||
Join Date: Nov 2006 Location: Inside an igloo, Canada
Posts: 313
| Just use simple math I assume the ball has x, y pixel coordinates already since you mentioned that you got it bouncing. Also get Paddle Y position from center (assuming that paddle is 40 pixels wide) example: If ball X value(horizontal) is >= right paddle AND if ball Y value (vertical) >= (paddle center - 20pixels) AND if ball Y value (vertical) <= (paddle center+20pixels) That is very simple logic to use for it. It will do simple calculation and determine if ball is near paddle. Don't know if you want actual .net code - I'm not very good at .NET I'm also curious, how are you making the ball bounce? Is it just using something like position = position - (20) changing 20 to positive or negative will change the direction x-(-x) = + || AMD Athlon64 3800+ Venice | Asus A8N5X s939 | OCZ Premier PC3200 Du-Ch 1GB | Sapphire X1600Pro 512MB PCI-e | 1xWD 80Gb & 1xWD 250Gb Sata(s) | Antec SLK3800B Case | Enermax NoiseTaker 485W || | ||||||||||||||
| | | ||||||||||||||