Simple Game
Simple Game
Simple Game
Simple Game
Simple Game
Simple Game Simple Game Simple Game Simple Game Simple Game Simple Game Simple Game Simple Game
Simple Game Simple Game
Simple Game
Go Back  Xtreme Visual Basic Talk > > > Simple Game


Reply
 
Thread Tools Display Modes
  #1  
Old 08-07-2012, 08:19 PM
jessepindick jessepindick is offline
Newcomer
 
Join Date: Aug 2012
Posts: 4
Default Simple question - Please help! :)


Hello, This is my first time posting here, i'm new to VB and i'm using it for a school subect (Information Process and Technology)

We had to make a basic game and me and my mate went with a game called
"Jetman" The aim if the game is to help obama escape the country by dodging the oncoming terrorist planes. Its a top down view of the players Jet, and we've programmed enemy jets to spawn at the top of the screen and come down, but the problem is we don't know how to make it spawn randomly. at the moment the enemy jets spawn in the same 3 spots and run down the form. Therefore the player can just sit in a corner and never die.

If any one knows how to make the 'Enemy jets' spawn in random position at the top of the form rather than the same columns, it would be greatly appreciated!!

Thanks in advance!!

PS: Jesse Is my mate and partner in the project =P

Last edited by jessepindick; 08-07-2012 at 09:34 PM.
Reply With Quote
  #2  
Old 08-08-2012, 12:47 PM
Qua's Avatar
QuaSimple Game Qua is offline
Impetuous & volatile

* Expert *
 
Join Date: Apr 2005
Posts: 2,177
Default

The Random class can generate random numbers for you. Use this to pick a column at random. Here's some example code selecting a random column between 9 columns:

Code:
dim random As New Random()
dim nextPlaceToSpawn as integer = random.Next(0, 9)
__________________
Reading is the foundation for all knowledge - Unknown.
Reply With Quote
  #3  
Old 08-08-2012, 07:06 PM
jessepindick jessepindick is offline
Newcomer
 
Join Date: Aug 2012
Posts: 4
Default

Thanks for the reply! will this work for multiple 'jets' at once?
Reply With Quote
  #4  
Old 08-09-2012, 04:01 AM
Qua's Avatar
QuaSimple Game Qua is offline
Impetuous & volatile

* Expert *
 
Join Date: Apr 2005
Posts: 2,177
Default

Quote:
Originally Posted by jessepindick View Post
Thanks for the reply! will this work for multiple 'jets' at once?
Yes, if you generate a random number for individual enemy
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Simple Game
Simple Game
Simple Game Simple Game
Simple Game
Simple Game
Simple Game Simple Game Simple Game Simple Game Simple Game Simple Game Simple Game
Simple Game
Simple Game
 
Simple Game
Simple Game
 
-->