Sometime the momo doesn't rotate properly.

Get help using Construct 2

Post » Wed Sep 03, 2014 9:43 am

When I left click, the momo is suppose to fire from the cannon with a given speed and cannon's angle but sometime it doesn't. I've uploaded the code that i've used.
You do not have the required permissions to view the files attached to this post.
B
4
S
1
Posts: 23
Reputation: 621

Post » Wed Sep 03, 2014 10:47 am

so you are setting the angle to aim at to the angle between mouse.x,mouse.y and mouse.x, mouse.y , this deems strange, because what is the angle between the same coordinates?

why not just set angle towards mouse.x,mouse.y?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Sep 03, 2014 11:04 am

I forgot mouse_x and mouse_y are the coordinates of the mouse when the users presses the left click after that he drags the mouse and i'm getting the angle between that and current position of the mouse.
B
4
S
1
Posts: 23
Reputation: 621

Post » Wed Sep 03, 2014 11:08 am

Strike that..

guess I understand what you are trying to achieve..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Sep 03, 2014 11:17 am

If you are expecting the sprite to point at the mouse, this code won't do that..

you are setting the angle of the cannon to the angle between mouse start and mouse end (to put it simply)
this means the cannon doesn't take into account where the mouse is..

if you left click and move right the angle will be 0
if you left click and move left the angle will be 180
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Sep 03, 2014 11:37 am

No..no.. I don't want the sprite to point to the mouse. I want the sprite to rotate to the angle between previous mouse_X/Y and current mouse. I thought this was problem with bullet behavior or something. It works most of the time but some time it doesn't take the angle into account.
B
4
S
1
Posts: 23
Reputation: 621

Post » Wed Sep 03, 2014 11:53 am

Why not set the bullets angle of motion to AngleToAimAt instead of sprcannon degrees?

And any reason why you are setting position of sprMomo instead of spawning it?
Problem might be you are not referencing sprMomo in your events..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Sep 03, 2014 12:04 pm

I face the same problem with angleToAimAt. That's why I tried sprCannon's angle. The funny thing is even if the sprCannon is facing the right direction the momo will not act as if sprCannon's angle is 0. So, I thought It was problem with bullet behaviour.

For no reason other than I felt like it, would it be different if I spawned it?
B
4
S
1
Posts: 23
Reputation: 621

Post » Wed Sep 03, 2014 12:30 pm

I guess the issue is the sprMomo isn't referenced in the event, also if you are using set position the bullet behaviour will already be enabled,..

I'm not sure what MomoIsInsideCannon does.. Or what Momofired Does..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: unicornspitfire and 71 guests