Maze - Colour Detection
Maze - Colour Detection
Maze - Colour Detection
Maze - Colour Detection
Maze - Colour Detection
Maze - Colour Detection Maze - Colour Detection Maze - Colour Detection Maze - Colour Detection Maze - Colour Detection Maze - Colour Detection Maze - Colour Detection Maze - Colour Detection
Maze - Colour Detection Maze - Colour Detection
Maze - Colour Detection
Go Back  Xtreme Visual Basic Talk > > > Maze - Colour Detection


Reply
 
Thread Tools Display Modes
  #1  
Old 05-25-2009, 07:00 AM
RedBooster RedBooster is offline
Newcomer
 
Join Date: May 2009
Posts: 3
Default Maze - Colour Detection


Hi, I am fairly new to visual basic's and I am trying to make a tower defense-like game where a robot follows a path automatically based on colour detection. It must be able to also flag the previous direction so it doesn't double back on it self.

http://i564.photobucket.com/albums/s...r/towerdef.jpg

A picture of my game is above and the labels are just detecting the colours at the top, bottom, left and right. The code I am trying to use for that is:

Code:
    clr(1) = Point(x + imgRobot1.Width + 10, y + imgRobot1.Height / 2) 'Right Direction
    clr(2) = Point(x - 10, y + imgRobot1.Height / 2) 'Left Direction
    clr(3) = Point(x + imgRobot1.Width / 2, y - 10) 'Up Direction
    clr(4) = Point(x + imgRobot1.Width / 2, y + imgRobot1.Height + 10) 'Down Direction
But, I am sure there has to be a better way, I am not even sure if that is right :S
Also, I would like to know how to add a radius of colour detection because once I add towers I want to it attack only when the robot is in range...

Well any help is appreciated on how I go about doing this.

~RedBooster
Reply With Quote
  #2  
Old 05-25-2009, 07:52 AM
coolfahad76 coolfahad76 is offline
Newcomer
 
Join Date: May 2009
Posts: 2
Default

Hey i can help you dave. Meatspin LAWL?
Reply With Quote
  #3  
Old 05-25-2009, 07:18 PM
vb5prgrmrMaze - Colour Detection vb5prgrmr is offline
Senior Contributor

* Expert *
 
Join Date: Mar 2009
Posts: 1,087
Default

Maybe the links in this thread may help you ...

http://www.tek-tips.com/viewthread.c...1517633&page=1

Good Luck
Reply With Quote
  #4  
Old 05-28-2009, 05:15 PM
AdrianDeAngelis's Avatar
AdrianDeAngelis AdrianDeAngelis is offline
Contributor
 
Join Date: May 2005
Location: Australia
Posts: 549
Default

Perhaps a better way would be to do something like this

Create an array where each point in the array represents a square in your game... spaces with zero in them could represent free space that you can build towers on, spaces with negative numbers are not buildable or walkable and for the path itself you would fill the array with numbers starting from 1 to n and when a monster is going to move off say square number 1 you just get it to move to square 2.

Probably a better way to do it would be to also have an array of pathing nodes that tells the monster which point on the map it should move to next.

Now getting the towers to fire at monsters is relatively easy but to do it efficiently requires some thought.

Whenever you create a tower or upgrade it you will need to test all the squares against which it can fire at and using yet another array for each square, link the ID's of the towers which can fire at that square to that square. Likewise whenever a monster moves onto a square you should link its ID to another array linked to the square. Then it becomes simple... you only test the squares that have monsters on them and check if there are towers that are ready to fire at the monsters in the square.

So your game types could look something like this
Code:
Type TowerDefenseMap .graphic as integer 'what graphic on this square .anim as single 'in case we want to animate this square .Buildable as boolean 'can you build a tower here .walkable as boolean 'can monsters walk onto here .Tower as integer 'ID of tower built here .monsters() as integer 'dynamic array of monsters on this square .inRange() as integer 'dynamic array of towers in range of this square End Type 'create map as big or as small as you want Dim Map(1 to 10, 1 to 8) 'you would also have a separate dynamic array of monsters and towers 'as well as an array containing the pathing nodes for the map... 'your monster would start at node 1 and move to node 2 etc...
__________________
Automation error... What do you mean automation error you %#@*&!$ thing!

Star Admiral: 3D tactical space sim *** New Version 0.38 10/01/09 ***
Damage, shields and special weapons systems
Reply With Quote
  #5  
Old 05-29-2009, 02:17 PM
Euroclydon's Avatar
Euroclydon Euroclydon is offline
Regular
 
Join Date: May 2009
Location: Northern Indiana, USA
Posts: 70
Default

If you need help with pathfinding, have a look at this thread:

Pathfinding
__________________
"Have a place for everything and keep the thing somewhere else; this is not a piece of advice, it is merely a custom." - Mark Twain
Reply With Quote
  #6  
Old 05-29-2009, 09:24 PM
AdrianDeAngelis's Avatar
AdrianDeAngelis AdrianDeAngelis is offline
Contributor
 
Join Date: May 2005
Location: Australia
Posts: 549
Default

This is really not a pathfinding issue... most tower defense games have a set path with one or two branch points that takes the creeps from A to B. To implement A* in this context is overkill
__________________
Automation error... What do you mean automation error you %#@*&!$ thing!

Star Admiral: 3D tactical space sim *** New Version 0.38 10/01/09 ***
Damage, shields and special weapons systems
Reply With Quote
  #7  
Old 06-02-2009, 04:37 PM
Euroclydon's Avatar
Euroclydon Euroclydon is offline
Regular
 
Join Date: May 2009
Location: Northern Indiana, USA
Posts: 70
Default

Ah.

I've actually never heard of a "tower defense" genre. What's the basic idea behind it?

Me.Clueless
__________________
"Have a place for everything and keep the thing somewhere else; this is not a piece of advice, it is merely a custom." - Mark Twain
Reply With Quote
  #8  
Old 06-02-2009, 07:03 PM
Flamespewer Flamespewer is offline
Freshman
 
Join Date: Sep 2008
Posts: 35
Default

you have a certain path and monsters go down it and you build towers to kill the monsters. you try to keep the monsters from going to the end of the path.

link to one-
http://www.miniclip.com/games/canyon-defense/en/
Reply With Quote
  #9  
Old 06-02-2009, 07:35 PM
Qua's Avatar
QuaMaze - Colour Detection Qua is offline
Impetuous & volatile

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

Quote:
Originally Posted by AdrianDeAngelis View Post
This is really not a pathfinding issue... most tower defense games have a set path with one or two branch points that takes the creeps from A to B. To implement A* in this context is overkill
I wouldn't generalize that far. Whereas there certainly are tower defences that use fixed unblockable paths, there also is plenty of tower defences that do allow you to block the paths and thus introducing mazing (which really is one of the simplest yet funniest concepts in TDs) which will introduce the need for a path finding algorithm such as Djkstras or A*.

Tower Defence is a genre introduced by the classical arcade game Rampart a long time ago. I would say it wasn't really popularized until blizzard released the games Star Craft and Warcraft 3 where tower defences were created as custom maps and really was one of the most played maps until dota arrived.
__________________
Reading is the foundation for all knowledge - Unknown.
Reply With Quote
  #10  
Old 06-03-2009, 10:12 AM
Euroclydon's Avatar
Euroclydon Euroclydon is offline
Regular
 
Join Date: May 2009
Location: Northern Indiana, USA
Posts: 70
Default

I have Warcraft II myself. Would this kind of game be like taking out the approaching orcs using only guard towers, and trying to keep them away from the Town Hall?

(P.S. AdrianDeAngelis, your avatar looks great. Where is the ship from?)
__________________
"Have a place for everything and keep the thing somewhere else; this is not a piece of advice, it is merely a custom." - Mark Twain
Reply With Quote
  #11  
Old 06-03-2009, 08:05 PM
vb5prgrmrMaze - Colour Detection vb5prgrmr is offline
Senior Contributor

* Expert *
 
Join Date: Mar 2009
Posts: 1,087
Default

Looks like BSG...
Reply With Quote
  #12  
Old 06-04-2009, 03:11 AM
AdrianDeAngelis's Avatar
AdrianDeAngelis AdrianDeAngelis is offline
Contributor
 
Join Date: May 2005
Location: Australia
Posts: 549
Default

Quote:
I wouldn't generalize that far. Whereas there certainly are tower defences that use fixed unblockable paths, there also is plenty of tower defences that do allow you to block the paths and thus introducing mazing (which really is one of the simplest yet funniest concepts in TDs) which will introduce the need for a path finding algorithm such as Djkstras or A*.
Very true but I did say "most" tower defense games... I would still contend though that for this particular tower defense game at this point using A* would be overkill.

Quote:
I have Warcraft II myself. Would this kind of game be like taking out the approaching orcs using only guard towers, and trying to keep them away from the Town Hall?
Pretty much...

Quote:
(P.S. AdrianDeAngelis, your avatar looks great. Where is the ship from?)
Its actually a mock-up model that I made for my space sim... it was based on BSG but a bit of a BSG and star trek hybrid.
__________________
Automation error... What do you mean automation error you %#@*&!$ thing!

Star Admiral: 3D tactical space sim *** New Version 0.38 10/01/09 ***
Damage, shields and special weapons systems
Reply With Quote
  #13  
Old 06-06-2009, 12:13 PM
Euroclydon's Avatar
Euroclydon Euroclydon is offline
Regular
 
Join Date: May 2009
Location: Northern Indiana, USA
Posts: 70
Default

Sounds like one of those games that seems too easy at first. Kind of a strategy/puzzle combo. Those are interesting too play. (Maybe too interesting - the kind you stay up until 2 in the morning playing. )

Glad to find other people who know Warcraft II! Makes me curious...

(AdrianDeAngelis, sent you a PM the other day. Make sure to check!)
__________________
"Have a place for everything and keep the thing somewhere else; this is not a piece of advice, it is merely a custom." - Mark Twain
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
Maze - Colour Detection
Maze - Colour Detection
Maze - Colour Detection Maze - Colour Detection
Maze - Colour Detection
Maze - Colour Detection
Maze - Colour Detection Maze - Colour Detection Maze - Colour Detection Maze - Colour Detection Maze - Colour Detection Maze - Colour Detection Maze - Colour Detection
Maze - Colour Detection
Maze - Colour Detection
 
Maze - Colour Detection
Maze - Colour Detection
 
-->