0

I have written a formula to calculate the x and y speed of an object following another object given that I want speed to = 5.

Perhaps I am just being and idiot and my working is incorrect but when I try to run the flash game it compiles but gets a run time error:

TypeError: Error #1006: value is not a function.
    at avoiderv2_fla::MainTimeline/anenemyMovement()

This is the calculation I am using (yes I have defiantly tracked the issue back to this particular line)

e.target.ndx = (Math.sin((Math.asin(e.target.dx(Math.sin(90)/e.target.speed)))*180/Math.PI)*(e.target.speed/Math.sin(90)))

Any idea why I am getting this error? Cheers

1 Answer 1

2

...e.target.dx(Math.sin(90)... portion looks suspicios. Are you sure dx is a function?

I think it should be ...e.target.dx * (Math.sin(90)... or something similar (notice *).

Sign up to request clarification or add additional context in comments.

3 Comments

Thankyou, that worked :) Sorry I should have specified, dx and ndx are variables, I didn't think I would need a * as I thought actionscript would take it for granted it was multiplying but apparently not. Thanks
All languages in common use requre you to specify operator (usually *) for multiplcation. Complexity that comes from trying to specify/parse language that allows a x or even ax to be treated as multiplication of a and x is too high to be safe and useful in general-purpose language.
Well the calculation worked anyway, there is still something wrong with it as it always returns 1, guess I got some math wrong, I will take a better look

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.