Lock angle while in toward

Get help using Construct 2

Post » Mon Nov 26, 2012 12:29 am

I try to understand the catmullrom example made by R0J0hound (genius by the way) and I don't know how to prevent rotation when the sprite go toward. I woul like a isometric movement and not a top-view one. I tried to compare angle (in between condition) and set to 0 when this is greater than 0.1 and not work. Someone knows how can I do this? Thanks

Example link: http://www.scirra.com/forum/follow-path-behavior_topic47235_page2.htmlRenatoB2012-11-26 19:31:47
B
65
S
13
G
2
Posts: 969
Reputation: 6,732

Post » Mon Nov 26, 2012 12:33 am

Let's ask R0J0Shtein the question
@R0J0Hound , I know you are there ! Lurking in the dark ... Searching for post to resolve and to show your awesome genius unicorn solving skills even if it's really obvious that you are an awesome unicorn genius ... Oh man ... I scare myself sometimes !

Cheers !
B
35
S
16
G
16
Posts: 2,222
Reputation: 16,589

Post » Mon Nov 26, 2012 11:06 am

Someone could really help me. I already lost much time trying to solve this, without success. Please.RenatoB2012-11-26 12:40:48
B
65
S
13
G
2
Posts: 969
Reputation: 6,732

Post » Mon Nov 26, 2012 9:31 pm

To make it have no rotation you will need to add another variable to the Sprites and call it "angle_toMove". Then istead of setting the angle of the sprite set that variable to angle(self.x,self.y,self.target.x,self.targety). You will also need to change the two "move forward" actions to "move at angle" actions, where the angle will be self.angle_toMove.

I don't understand the isometric portion of the question, can you expound on what is different about isometric movement?
B
79
S
24
G
54
Posts: 4,749
Reputation: 40,761

Post » Mon Nov 26, 2012 11:45 pm

Salve R0J0hound. Thank you for this great script and for helping me.

The Sprite now has stopped rotating. Thank you. However, the value defined for the "speed" variable no longer works. I assigned the "speed" value for the "Move" value (Move pixels self.speed at angle self.angle_toMove angle) on both actions, but not solved.

Thank you again and sorry for the confusion about the analogy that I used to compare the type of motion.
RenatoB2012-11-26 23:46:54
B
65
S
13
G
2
Posts: 969
Reputation: 6,732

Post » Mon Nov 26, 2012 11:56 pm

R0J0hound,

I found the error: I forgot to include "* dt" in the expression that determines the speed. sorry.

But the movement is not so smooth as before, when the sprite rotated. Now the sprite gives some leaps when changing the direction of motion.

RenatoB2012-11-26 23:57:51
B
65
S
13
G
2
Posts: 969
Reputation: 6,732

Post » Tue Nov 27, 2012 10:51 pm

The movement of the first example (http://dl.dropbox.com/u/5426011/examples 208/catmullrom.capx%) is very interesting. But I could not control the beginning of the movement, which is based on position change by time, right? I do not understand how to stop time and just launch it whenever you want. Could you show me the way to have this control?
B
65
S
13
G
2
Posts: 969
Reputation: 6,732


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 23 guests