HardwareLogic

Go Back   HardwareLogic > Specific Hardware > Software & OSs
Home Forums Rules All AlbumsBlogs Donate Subscriptions Register Mark Forums Read vBExperience

Software & OSs Operating Systems, Anti-Virus, Utilities and Programs.

Reply
 
LinkBack Thread Tools
Old May 24th, 2007   #1
wow.... so many letters..
Points: 1,382, Level: 20
Points: 1,382, Level: 20 Points: 1,382, Level: 20 Points: 1,382, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
g-relk's Avatar
 
Join Date: Mar 2007
Location: batemans bay, australia
Posts: 94
Default help with vb.net

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
g-relk is offline   Reply With Quote
Old May 24th, 2007   #2
Modder-ator
Points: 18,569, Level: 86
Points: 18,569, Level: 86 Points: 18,569, Level: 86 Points: 18,569, Level: 86
Activity: 15%
Activity: 15% Activity: 15% Activity: 15%
 
gvblake22's Avatar
 
Join Date: Dec 2005
Location: Tempe Desert
Posts: 6,206
Blog Entries: 1
Default Re: help with vb.net

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...



gvblake22 is online now   Reply With Quote
Old May 24th, 2007   #3
Points: 2,077, Level: 27
Points: 2,077, Level: 27 Points: 2,077, Level: 27 Points: 2,077, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
pc_guy's Avatar
 
Join Date: Nov 2006
Location: Inside an igloo, Canada
Posts: 313
Default Re: help with vb.net

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 ||
pc_guy is offline   Reply With Quote
Reply

  HardwareLogic > Specific Hardware > Software & OSs


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 16:45.


Powered by vBulletin® Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0
© HardwareLogic 2005 - 2008. All Rights Reserved


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45