antmj2317
asked on
Moving Multiple Pictureboxes, VB.NET
I'm working on a small game in VB, and what I'd like to be able to do is move some pictureboxes around on the screen in random directions. I can get the latter to work, unfortunately I can only have it move 1 at a time in sequence.
I'd like to be able to move all 4(I'll start with 2 to make it easier) pictureboxes at once. I have some ideas, but the more pictureboxes I put on will make them seem less 'simultaneous'
I'd like to be able to move all 4(I'll start with 2 to make it easier) pictureboxes at once. I have some ideas, but the more pictureboxes I put on will make them seem less 'simultaneous'
create a thread for each picturebox...
It ll look like simultaneous.. If u ave more then one cpu or core then they ll be simultaneous
It ll look like simultaneous.. If u ave more then one cpu or core then they ll be simultaneous
Sounds like you are using a LOOP to move the PictureBox.
Move to a Timer based approach where you update the position of all boxes in the Tick event.
If you show us your existing code then we can make suggestions on how to modify it.
Move to a Timer based approach where you update the position of all boxes in the Tick event.
If you show us your existing code then we can make suggestions on how to modify it.
ASKER
XNA is not a solution, this *must* be done in a visual language such as VB or C# to start off with, maybe down the line though.
Timer sounds like it *might* work..
How do I start a thread in VB.NET?
Timer sounds like it *might* work..
How do I start a thread in VB.NET?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you're going the threading route then be sure to use a delegate w/ Invoke() to marhshal the calls from your created threads to the main UI thread where it is safe to move the PictureBoxes. If you have VB.Net 2005 (or above) then you can use the BackgroundControl worker to do the legwork for you.
This does't directly answer you queston, but have you checked out XNA?
http://creators.xna.com/en-US/
It's a far better way to create games, and it's still easy. Lots of samples and a great community to help you out.
Making graphics in GDI/GDI+ is hard to make look nice.
// Johan