Tower Defence Game Sniper Tower
Tower Defence Game Sniper Tower
Tower Defence Game Sniper Tower
Tower Defence Game Sniper Tower
Tower Defence Game Sniper Tower
Tower Defence Game Sniper Tower Tower Defence Game Sniper Tower Tower Defence Game Sniper Tower Tower Defence Game Sniper Tower Tower Defence Game Sniper Tower Tower Defence Game Sniper Tower Tower Defence Game Sniper Tower Tower Defence Game Sniper Tower
Tower Defence Game Sniper Tower Tower Defence Game Sniper Tower
Tower Defence Game Sniper Tower
Go Back  Xtreme Visual Basic Talk > > > Tower Defence Game Sniper Tower


Reply
 
Thread Tools Display Modes
  #1  
Old 06-06-2012, 02:26 PM
Doomknt Doomknt is offline
Newcomer
 
Join Date: Jun 2012
Posts: 1
Default Tower Defence Game Sniper Tower


I have been working on a tower defence game in VB6 for a couple days now and can't seem to figure out how to make a tower fire against an enemy. I already have the range, damage, and speed of fire in place yet I can't make it shoot at the enemy. Does anyone know how I could use If statements to make a projectile fire from a tower to a moving enemy?
This is what I got for moving the projectile towards the enemy yet it never goes fast enough to actually hit the enemy.
dm(1) is the distance from the tower to the monster
TRange(1) is the range of the tower
ElseIf M1Move.Enabled = True And T1 = Sniper And dM(1) < TRange(1) + 50 Then
ArrowT1.Left = ArrowT1.Left + ((M1.Left - ArrowT1.Left) / 10)
ArrowT1.Top = ArrowT1.Top + ((M1.Top - ArrowT1.Top) / 10)

Any help?
Reply With Quote
  #2  
Old 06-06-2012, 04:26 PM
passel's Avatar
passelTower Defence Game Sniper Tower passel is offline
Sinecure Expert

Super Moderator
* Guru *
 
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 8,024
Default

How fast is the monster moving?
Regardless, the main problem would seem to be since you base the speed of the arrow on the distance between the arrow and the monster, then the closer the arrow gets to the monster, the slower the arrow goes.
At some point you'll slow down enough to match the speed of the monster and maintain a fairly constant distance following it.

I would assume you would want the arrow to have a constant speed, or a speed that slows down due to gravity and/or air resistance over the range of travel, rather than depend on how far it is from the target.
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
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
Tower Defence Game Sniper Tower
Tower Defence Game Sniper Tower
Tower Defence Game Sniper Tower Tower Defence Game Sniper Tower
Tower Defence Game Sniper Tower
Tower Defence Game Sniper Tower
Tower Defence Game Sniper Tower Tower Defence Game Sniper Tower Tower Defence Game Sniper Tower Tower Defence Game Sniper Tower Tower Defence Game Sniper Tower Tower Defence Game Sniper Tower Tower Defence Game Sniper Tower
Tower Defence Game Sniper Tower
Tower Defence Game Sniper Tower
 
Tower Defence Game Sniper Tower
Tower Defence Game Sniper Tower
 
-->