• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

i need help please

Participant ,
Sep 21, 2012 Sep 21, 2012

Copy link to clipboard

Copied

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

TOPICS
ActionScript

Views

1.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 21, 2012 Sep 21, 2012

Copy link to clipboard

Copied

Do you use Tween code in your game at all?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 21, 2012 Sep 21, 2012

Copy link to clipboard

Copied

i know only the motion tween and i kow how to use it in the flash ( i mean not in the code)  and i guess not that i want

because i want to summon (monster) and when he used its spell the spell should follow the enemy

thank you dr.murphy but can you explain more because iam not pro in flash like you so i need more explaining .

thank you again for your replay

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 21, 2012 Sep 21, 2012

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 21, 2012 Sep 21, 2012

Copy link to clipboard

Copied

no , not this the problem  ..

i want object follow and other object until he can catch it

look at this img please

http://im25.gulfup.com/2012-09-21/1348236194241.png

i want this pet to send electric charge  to the bat and that charge should follow him if he try to run or something like that

thank you for your replay

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 21, 2012 Sep 21, 2012

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 21, 2012 Sep 21, 2012

Copy link to clipboard

Copied

noo , i dont want to use anything from math class cos, tan ... etc

because i realy dont know what they mean i only use random and round and some simple things

can you give me another way?

thank you for the replay

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 21, 2012 Sep 21, 2012

Copy link to clipboard

Copied

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...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 21, 2012 Sep 21, 2012

Copy link to clipboard

Copied

LATEST

yeah , maybe you are  right , thank you

but still , i always find ways to run from these problem with flags and( IF cond in if in if...) Nesting

i will try with rotate the objects  , maybe that will fix the problem

thank you

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines