Tower Defense

I want to knwo how to make the turrent.

Page 1 of 1

9 Replies - 3189 Views - Last Post: 03 November 2008 - 06:17 PM

#1 blaze32707  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 8
  • Joined: 02-November 08

Tower Defense

Post icon  Posted 02 November 2008 - 12:40 PM

I already have the monsters moving using arrays. Now i want to create the torrent that will shoot and fire at the enemies. I know how to make the torrent point and fire at 1 enemy but not when there is multiple enemies. Also, it would be nice to understand the concept of
Math.atan2
and code for being able to place and not place an object in a specific position. Well actually want to know the easiest way with less bugs for i could probably do it the long,hard,confusing way.


P.S. ty for posts and answers

Is This A Good Question/Topic? 0
  • +

Replies To: Tower Defense

#2 -Fabez-  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 46
  • Joined: 19-October 08

Re: Tower Defense

Posted 03 November 2008 - 10:02 AM

Here is a link for Math.Atan2 http://www.adobe.com...tionary451.html .In order to shoot an enemy using the turret, you can use the tween class and the hit test function.
Was This Post Helpful? 0
  • +
  • -

#3 blaze32707  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 8
  • Joined: 02-November 08

Re: Tower Defense

Posted 03 November 2008 - 02:11 PM

Ty for link . but i meant if there were 2 enemies coming at once how does the turret know which one to point at and fire.......
Was This Post Helpful? 0
  • +
  • -

#4 -Fabez-  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 46
  • Joined: 19-October 08

Re: Tower Defense

Posted 03 November 2008 - 02:13 PM

It depends on what you code, for example you could aim for the closest one, or the one with the most health, etc.
Was This Post Helpful? 0
  • +
  • -

#5 blaze32707  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 8
  • Joined: 02-November 08

Re: Tower Defense

Posted 03 November 2008 - 02:15 PM

true you have a point but how would i go about doing that lol....since my instant names our like ("monster" + variable)
Was This Post Helpful? 0
  • +
  • -

#6 -Fabez-  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 46
  • Joined: 19-October 08

Re: Tower Defense

Posted 03 November 2008 - 02:21 PM

You have lots of choices, for example, you can aim for the closest one using co-ordinates, or you could aim for the monster with the lowest variable suffix. Think of the methods you want to use and I will tell you how to code it.
Was This Post Helpful? 0
  • +
  • -

#7 blaze32707  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 8
  • Joined: 02-November 08

Re: Tower Defense

Posted 03 November 2008 - 02:30 PM

ok lets just code it so the turret fires at the monster closest to the base, based on the trail that is set up for it.

This post has been edited by blaze32707: 03 November 2008 - 02:33 PM

Was This Post Helpful? 0
  • +
  • -

#8 -Fabez-  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 46
  • Joined: 19-October 08

Re: Tower Defense

Posted 03 November 2008 - 02:49 PM

In order to do this you will need to enumerate all of the monsters, gathering all of thier co-ordinates. Then subtract them from the turrets position, wrapping the subtraction in the abs() command, in order to obtain a positive number. After this you will need to select the monster that produce the lowest numbers from these calculations, as it will be the closest.
Was This Post Helpful? 0
  • +
  • -

#9 blaze32707  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 8
  • Joined: 02-November 08

Re: Tower Defense

Posted 03 November 2008 - 03:26 PM

lol i understand what i have to do, but i don't quite understand how to do it; like how to set it up, could it be possible to give me an example or make something and post on a sight so i could watch it i usually do better with visual things any way lol or you can just type the code, but the way i type code is different than other peoples so it might be confusing lol. A link would also be helpful but then again I'm here because i can't find anything helpful other places.

P.S. Ty for comments and help lol

This post has been edited by blaze32707: 03 November 2008 - 03:28 PM

Was This Post Helpful? 0
  • +
  • -

#10 CyanBlue  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 6
  • View blog
  • Posts: 156
  • Joined: 01-September 06

Re: Tower Defense

Posted 03 November 2008 - 06:17 PM

I'd say you make list of the steps you have to take to get this done, and provide what you can and ask for what you cannot... ;)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1