What should you do if a sprite doesn,t change direction?

Get help using Construct 2

Post » Thu Oct 12, 2017 1:05 am

There is a sprite whit the platform behavior that is supposed to move left and rigth when it collides whit another sprite and can jump. But it only changes movement direction when it jumps when it supposed to do it no matter if it jumps or not when it collides whit the sprites that is supposed to change it,s movement direction. What should you do?
B
12
S
2
Posts: 267
Reputation: 1,344

Post » Thu Oct 12, 2017 7:03 am

Hi @Calfuso ,

Your post is not very clear. Are you saying your sprite do not "move left and right" when it collides with other sprites ?
B
12
S
5
G
1
Posts: 39
Reputation: 1,528

Post » Thu Oct 12, 2017 9:38 am

Consider posting your capx. Indeed, your explanation is not very clear.
Perhaps you could check the How do I FAQ and look for the keyword "Patrol" it will show a few examples of how to handle the change of direction for an automated sprite.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
312
S
129
G
101
Posts: 7,432
Reputation: 75,388

Post » Thu Oct 12, 2017 11:02 am

The sprite is supposed to move to the rigth whit the No Default Controls platform behavior and when it collides whit another sprite move to the left whit the No Default Controls behavior. Then when it collides whit the another type of the same sprite it collided whit move to the rigth whit No Default Controls platform behavior. Then it is supposed to do the same thing. Here is the events and actions:
Event-Variable-"rigth-Action-Simulate Platform Pressing Rigth
Event-Variable-"left"-Action-Simulate Platform Pressing Left
Event-Sprite collides whit Sprite-Action-Set Value to "left"
Else-Set Value to "rigth"
The sprite doesn,t change movement direction when it is supposed to and only does it if it jumps after it has collided whit a type of the another sprite. What should you do?
B
12
S
2
Posts: 267
Reputation: 1,344

Post » Thu Oct 12, 2017 5:16 pm

event: sprite collides
sub event: sprite-action <> "left" then set value "left"
sub event: else "right"
B
53
S
24
G
70
Posts: 1,201
Reputation: 41,430

Post » Fri Oct 13, 2017 2:33 am

In this post i write the events and actions rigth. I have a sprite that is supposed to move left and rigth and can jump. The sprite is supposed to move to the rigth whit the No Default Controls platform behavior and when it collides whit another type of the same sprite it collided whit move to the rigth whit the No Default Controls platform behavior. Then it is supposed to do the same thing over and over again. Here is the events and actions.
Event-Sprite collides whit another sprite
Sub Event-Sprite-Variable-"rigth"-Action-Variable-Set Value To "left"
Else-Variable-Set Value To "rigth"
The sprite doesn,t move to the left whit the platform behavior when it collides whit the another sprite. It only changes movement direction if it has collided whit a type of the another sprite and jumps. It is supposed to change movement direction no matter if it has jumps or not. What should you do to make it do this?
B
12
S
2
Posts: 267
Reputation: 1,344

Post » Fri Oct 13, 2017 2:53 am

I did not write the events and actions rigth in my other posts in this topic. This time i write them rigth. I have a sprite that is supposed to move to left and rigth and can jump. The sprite is supposed to move to the rigth whit the No Default Controls platform behavior and when it collides whit another sprite move to the left whit the No Default Controls platform behavior. Then when it collides whit another type of the same sprite it collided whit move to the rigtjh whit the No Default Controls platform behavior. Then it is supposed to do the same thing over and over again. Here is the events and actions:
Event-Sprite-Variable="rigth"-Action-Simulate Control Pressing Rigth
Event-Sprite-Variable="left"-Action-Simulate Control Pressing Left
Event-Sprite collides whit another sprite
Sub Event-Sprite-Variable="rigth"-Action-Variable-Set Value To "left"
Else-Sprite-Variable-Set Value To "rigth"
The sprite doesn,t move to the left whit the No Defualt Controls platform behavior when it collides whit the another sprite. It only does change movement direction if it jumps. It is supposed to move to the left whit the No Default Controls platform behavior no matter if it jumps or not. How do you make the sprite do this?
B
12
S
2
Posts: 267
Reputation: 1,344

Post » Fri Oct 13, 2017 3:43 am

It would be much easier to understand your problem if you share your CAPX.
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :) If you'd like to hire me, please see this post
B
19
S
9
G
158
Posts: 2,381
Reputation: 84,389

Post » Sun Oct 15, 2017 1:10 pm

Here is my capx:
https://www.dropbox.com/s/jckpsdx6f7bqo ... .capx?dl=0
When you open the project you start at the layout and the location where the problem sprites are located. The player sprite is Sprite43. The sprite that is supposed to change direction is the varitions of Sprite70. The sprites that is supposed to make it change direction is the two varitions of Edgemarker4. The events and actions are in Event Sheet 4. To find the events and actions of Sprite 70 search for Sprite 70. When you preview the layout you start where Sprite43 are located. The two varitions of Sprite70 begins to move to the rigth whit the No Default platform behavior and when it collides whit Edgemarker4 moves to left whit the No Default Controls platform behavior. Then the two varitions of Sprite 70 doesn,t change moevment direction. I want to know how to make the varitions of Sprite 70 move to the rigth whit the No Defualt Controls platform behavior when they collide when they collide whit the Edgemarker4 again and then move to left and rigth over and over again whit the varitions of Edgemarker4. The events and actions of this is at the top of the Sprite70s events and actions.
B
12
S
2
Posts: 267
Reputation: 1,344

Post » Sun Oct 15, 2017 1:23 pm

You project size is 1GB???
And you don't even bother naming your sprites properly?
No, sorry man, I'm not downloading this.
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :) If you'd like to hire me, please see this post
B
19
S
9
G
158
Posts: 2,381
Reputation: 84,389


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 11 guests