Skip navigation
Currently Being Moderated

i need help please

Sep 21, 2012 5:15 AM

hi , how are you all?

i hope you all fine ..

 

here

iam programming a game and there is spell that summon monster then the monster should attack the enemy by his electric spell (range spell)  i want the spell to follow the enemy

then hit him

 

 

and here is the problem

i know how can i send it there but not by steps

like

enemy.x = spell.x

enemy.y = spell.y

if(hittest.....)

 

 

but i dont want that , i want the electric follow the enemy Then killing him

thank you

 
Replies
  • Currently Being Moderated
    Sep 21, 2012 5:21 AM   in reply to thunderxlight11111

    Do you use Tween code in your game at all?

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 21, 2012 6:55 AM   in reply to thunderxlight11111

    If you want to learn about how to use code to animate, then you should search Google using search terms like "AS3 Tween tutorial". 

     

    You will find plenty of resources where people have taken the time to explain how to use actionscript to make things animate.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 21, 2012 7:21 AM   in reply to thunderxlight11111

    Use Math.atan2 to get the angle towards the target and move in that direction.

     

    There are loads of 'mouse follower' tutorials on the web that describe this formula, here's one:

     

    http://asgamer.com/2009/character-movement-controls-follow-mouse

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 21, 2012 7:33 AM   in reply to thunderxlight11111

    thunderxlight11111 wrote:

     

    can you give me another way?

    ummm, no!

    Mate, you are not going to get very far if you have that attitude!

    My advice would be either bite the bullet and apply your brain, or give up now.

     

    Do some reading and learn how to use the Math API.

    I can recommend this book:

     

    http://www.amazon.com/Foundation-Actionscript-3-0-Animation-Making/dp/ 1590597915

     

    In any case, it sounds like the game you are attempting to build is currently way out of your league!

    Stop for a month or two while you do some background research...

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points