473,473 Members | 2,102 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

generate / control a number or "balls" moving inside a square

OJ
It's easy to control one ball (a graphic) to move and bounce inside a square.
But I don't know how to create and control a large number of balls (10 or
100) and count how many times they hit a wall of the square.

Anyone can help?? I have little experience in VB.net.

Thanks in advance.

OJ
Nov 21 '05 #1
3 1329
Design it so that each ball is a single class and create an instance of this
class on a separate thread for each ball that moves around.

Each ball will have properties (size, material that control elasticity for
bouncing, current location, momentum, direction of movement) and will know
how to draw itself in a container (another class).

Kind of basic but should get you started.

"OJ" <OJ@discussions.microsoft.com> wrote in message
news:FD**********************************@microsof t.com...
It's easy to control one ball (a graphic) to move and bounce inside a
square.
But I don't know how to create and control a large number of balls (10 or
100) and count how many times they hit a wall of the square.

Anyone can help?? I have little experience in VB.net.

Thanks in advance.

OJ

Nov 21 '05 #2
OJ,

I never like this graphical stuff, however in my opinion computers are that
fast that people cannot notice it if you do 100 changes in a row or do them
randomly by using more threads.

If it was my problem, than I would do it by probably by using an array and
do my complete routine in one great loop.

Instead that I instance one ball, (which is probably now already a class) I
would use an array of balls.

For each ball in my Balls
do the stuff you have now everytime with that ball
Next

Just my idea,

Cor
Nov 21 '05 #3
Check out the article on animation in Windows Forms Tips and Tricks.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"OJ" <OJ@discussions.microsoft.com> wrote in message
news:FD**********************************@microsof t.com...
It's easy to control one ball (a graphic) to move and bounce inside a
square.
But I don't know how to create and control a large number of balls (10 or
100) and count how many times they hit a wall of the square.

Anyone can help?? I have little experience in VB.net.

Thanks in advance.

OJ

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

41
by: AngleWyrm | last post by:
I have created a new container class, called the hat. It provides random selection of user objects, both with and without replacement, with non-uniform probabilities. Uniform probabilities are a...
29
by: Bill Marsden | last post by:
Hi. I am an under-graduate currently studying Open Source (Linux) vs Closed Source and Collaboration within the IT Community. I am fairly new to Javascript and I have written a "Lottery Program"...
15
by: Michael Rybak | last post by:
hi, everyone. I'm writing a 2-players game that should support network mode. I'm now testing it on 1 PC since I don't have 2. I directly use sockets, and both client and server do...
388
by: maniac | last post by:
Hey guys, I'm new here, just a simple question. I'm learning to Program in C, and I was recommended a book called, "Mastering C Pointers", just asking if any of you have read it, and if it's...
9
by: DJ Tuneman | last post by:
I've noticed that if I enable the "Application Framework" in the project for a Windows app, there's a bug when the programs load and I didn't even notice it until lately. If you click the "Show...
2
by: Bob | last post by:
I'm running sql server ver 7.0 SP4. I have an access project (.adp) that runs a view which is nothing more than a select statement. Access locks up solid when I try to run this query - with NO...
27
true911m
by: true911m | last post by:
I would like to solicit your thoughts and ideas (code can come later) about how you would approach a project idea I just tossed together. I chose this as a testbed for me to play with objects,...
5
by: playagain | last post by:
Please help me to build a list of examples of stack and queue in real life situation... Conditions: The object concerned must only one object. And the object must be tangible. Example: Queue...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.