# Possible Bug with custom movement?

Bugs will be moved here once resolved.

### » Tue Oct 02, 2012 1:31 am

Hi not sure if its a bug or maybe i just misunderstood something, so hope someone can help me.

I have an event that is triggered by "On created" as part of its actions i have it spawn another object which angle i change to 90. The spawned object have custom movement behaviour on it. So after i have changed it angle to 90, i set angle of motion so it matches the spawned object angle.

In another event i then tell it to accelerate 50 forward, which makes the object go toward 0 degree instead of 90.

However if i move the action "Angle of motion = object.angle" to another event and add an acceleration action as well. it moves the correct way.

I also tried adding "Angle of motion" and set its "angle of motion" to the newly spawned object angle together with an "Accelerate" action in the "On created" event. And it still moves towards 0 and not 90.

It seems to me that if you use the "spawn another object" and custom movement in the same event there are some problems, or maybe im doing something wrong.

Anyway im not sure if its a bug or not, can someone confirm it or maybe explain what im doing wrong?

Heres a link to a test:
Test custom movement

Thanksnimos1002012-10-02 03:10:52
B
41
S
10
G
2
Posts: 1,159
Reputation: 6,542

### » Tue Oct 02, 2012 4:50 pm

I don't think it's a bug, it's a kind of quirk of the custom movement which is by design.

Your actions happen in this order:
1. Set angle of motion
2. Accelerate

When the object is created it has zero speed, which also means if you ask for its angle, it has no motion and therefore no angle and just returns 0.

If you set the angle of motion of an object which is not moving, it effectively does nothing. The object is not moving so has no angle of motion, so there's nothing to change. Then when you do accelerate, since it has no angle of motion it uses 0 and goes to the right.

If you do it the other way around - accelerate then set the angle of motion - it works, because as soon as you accelerate there is an angle of motion, and that can then be set.

So, closing as not a bug I'm afraid...
Scirra Founder
B
362
S
216
G
75
Posts: 23,071
Reputation: 180,354

### » Tue Oct 02, 2012 4:57 pm

"So, closing as not a bug I'm afraid... "

Thats only good :)

And thanks for the explaination.
B
41
S
10
G
2
Posts: 1,159
Reputation: 6,542