3 Replies - 1179 Views - Last Post: 07 December 2012 - 01:57 PM Rate Topic: -----

#1 Sand-Man  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 13-November 12

Visual basic 2008 - Randomizing Movement

Posted 07 December 2012 - 08:31 AM

Hi all, I need some info on moving an object randomly across the screen. For example, a circle that just randomly drifts all over the screen, at various angles.
Thanks in advance for ANY help!
Is This A Good Question/Topic? 0
  • +

Replies To: Visual basic 2008 - Randomizing Movement

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8891
  • View blog
  • Posts: 33,344
  • Joined: 12-June 08

Re: Visual basic 2008 - Randomizing Movement

Posted 07 December 2012 - 08:40 AM

Utilize the 'random' name space.. and add to the x and y as needed.
Was This Post Helpful? 0
  • +
  • -

#3 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1043
  • View blog
  • Posts: 4,054
  • Joined: 02-July 08

Re: Visual basic 2008 - Randomizing Movement

Posted 07 December 2012 - 12:48 PM

You need a timer and in it's tick event you change the PB's location like modi was saying. To test it if it against the border you check whether the Top, Left, Bottom, Right properties are at the edges of the rectangle it is in - if its in a form - Me.ClientRectangle would work.
Was This Post Helpful? 1
  • +
  • -

#4 DarenR  Icon User is online

  • D.I.C Lover

Reputation: 431
  • View blog
  • Posts: 2,989
  • Joined: 12-January 10

Re: Visual basic 2008 - Randomizing Movement

Posted 07 December 2012 - 01:57 PM

you will also need to set boundries or the item will continue to randomize off screen
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1