Need help with Visual Basic.

Anything else. Post a funny site or tell us about yourself. Discuss current events or whatever else you want. Post off topic threads here.
Post Reply
User avatar
RuYi
Ex-Staff
Posts: 7145
Joined: Tue Apr 25, 2006 7:39 am
Location: Done.

Need help with Visual Basic.

Post by RuYi »

Ok, my turn for a Help with VB topic.

Basically, I want this:
Image
The little squares should be dragged onto the big square.
The little circles to the big circle.

If a circle goes to the square, it should be set back to the start point or whatever.

Problem is, I got no idea how to create a code for that. I been trying to figure it out for the past 2 days and I really have no idea.

I can make everything draggable, but the only problem I got is how to make the circle refuse the squares adn the square should refuse the circle. Don't matter how, as long as they refuse it.

Anyone can help me? :(
Image

User avatar
Firemouse
Active Member
Posts: 547
Joined: Fri Apr 20, 2007 5:13 am
Quick Reply: Yes
Location: greece

Post by Firemouse »

I can't help you, but if it makes you feel any better I tried dragging them :)
Image
Image

TwelveEleven
Veteran Member
Posts: 3806
Joined: Sat Mar 17, 2007 1:11 am
Quick Reply: Yes
Location: Heaven
Contact:

Post by TwelveEleven »

msn: twelveeleven1211@gmail.com

We might be able to work something out together.
<<banned from SRF for proof of botting. -SG>>

User avatar
Innovacious
Advanced Member
Posts: 2446
Joined: Mon Sep 11, 2006 9:24 pm
Quick Reply: Yes
Location: Off Topic
Contact:

Post by Innovacious »

Oooh, a game (kinda...) I know how to do this, i made a space invaders in VB once. That was probably one of my greatest creations in VB. And it wasnt just some silly single level clone. It had an unlimited amout of levels, each level the enemy would get faster and shoot more until about level 50 when they would stay the same (got a bit crazy when i made it go faster) Even had pickups n whatnot and the ship that passes by every now and then up the top. I even got so bored i made a bot that would play the game. Wasnt an 100% accurate bot of course, that would be boring, it would even seek out powerups when they came down, if 2 came down it would go for the best and if one was coming down but too many aliens were shooting it would stay back so it didnt get shot.

Damn, i went abit off topic :\ sorry, i loved that game, but i lost all of it, its completley gone :(

anywho, all the shapes (well, almost all objects) have a .left and a .top property, this contains the position of the top of the object and the left of the object (duh). You will also need to use the .width and .hieght properties too.

Code: Select all

if SCircle.left > BCircle.left and (SCircle.left + SCircle.width) < (BCircle.left + BCircle.width) then

      if SCircle.top < BCircle.top and (SCircle.top-SCircle.Height) > (BCricle.top - BCircle.Height then
            'whatever you want to do when the small shape is in the big one
      end if

end if


S=Small B=Big

Of course youll need to modify the names n whatnot and change the code to work with a square too. You could use an array of objects for the smaller shapes but im not sure if they are available in vb.net onwards, they took some sort of array out of it, cant remember which though.

Im guessing i might be a bit late on this anyway, been a while since you posted it.
ImageImage

User avatar
RuYi
Ex-Staff
Posts: 7145
Joined: Tue Apr 25, 2006 7:39 am
Location: Done.

Post by RuYi »

Not late lol, I got until Friday and I was still clueless about that code.
It helps alot, thanks! :love:

It's cool you managed to create a whole game in it, the codes and all that stuff are too confusing for me. Shame you lost it though. :(
Image

Post Reply

Return to “Off Topic Lounge”