Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Horizontal / Vertical movement with "Collision Trigger" not right #1659

Closed
fmatthew5876 opened this issue Mar 2, 2019 · 2 comments

Comments

@fmatthew5876
Copy link
Contributor

commented Mar 2, 2019

Create an event with trigger=collision, no event event code, and move_type=horizontal.

Move the player in the way of the event.

In RPG_RT, the event will stay there next to the player until the player moves. In Player, the event will turn around.

This behavior only happens if trigger=collision, otherwise the event will always turn around.

Finally, the stop count stuff near https://github.com/EasyRPG/Player/blob/master/src/game_event.cpp#L460 looks really suspect.

I've opened this issue to get some frame dumps of this movement type to fix it.

@fmatthew5876

This comment has been minimized.

Copy link
Contributor Author

commented Mar 2, 2019

Test cases

  1. Create EV01 with layer=same, move_type=horizontal, trigger=action, move_frequency=7, move_speed=6, and no code

Create EV02 parallel with this code

Loop:
  OpenSaveMenu

Setup the map like this horizontally

Tile Event
Grass Player
Grass EV01
Grass
Water

Now start a new game

Save EV01 stop count EV01 max stop count EV01 remaining step EV01 direction
1 1 4 0 2
4 4 4 0 2
5 0 4 128 1
6 0 4 0 1
30 24 4 0 1
31 0 4 128 3
32 0 4 0 3
56 24 4 0 3
57 0 4 128 1

Result: When event hits a barrier, waits until stop_count == 24 and then turns around.

  1. Change EV01 trigger=collision
Save EV01 stop count EV01 max stop count EV01 remaining step EV01 direction
1 1 4 0 2
4 4 4 0 2
5 0 4 128 1
6 0 4 0 1
30 24 4 0 1
31 0 4 128 3
32 0 4 0 3
36 4 4 0 3
37 1 4 0 3
40 4 4 0 3
41 1 4 0 3

Result: When event collides with player, stop count counts 1, 2, 3, 4 and repeats like this. Event stays stuck against player

  1. Change EV01 code to
SetMoveRoute: Player, Speed Down
Save EV01 stop count EV01 max stop count EV01 remaining step EV01 direction EV01 waiting execution Player move speed Player stop count
1 1 4 0 2 0 4 0
4 4 4 0 2 0 4 3
5 0 4 128 1 0 4 4
6 0 4 0 1 0 4 5
30 24 4 0 1 0 4 29
31 0 4 128 3 0 4 30
32 0 4 0 3 0 4 31
36 4 4 0 3 0 4 35
37 1 4 0 3 0 4 65535
38 1 4 0 3 0 3 65535
39 2 4 0 3 0 3 65536
41 4 4 0 3 0 3 65538
42 1 4 0 3 0 3 65535
43 1 4 0 3 0 2 65535
44 2 4 0 3 0 2 65536

Result: On frames 37 and 42, EV01 attempts to step into the player, which triggers its collision code to run a set a move route on the player. On the next frame, the move route causes the players move speed to decrease by 1.

  1. Change EV01 move_frequency=8
Save EV01 stop count EV01 max stop count EV01 remaining step EV01 direction EV01 waiting execution Player move speed Player stop count
1 0 0 128 1 0 4 0
2 0 0 0 1 0 4 1
22 20 0 0 1 0 4 21
23 0 0 128 3 0 4 22
24 0 0 0 3 0 4 23
25 1 0 0 3 0 4 65535
26 1 0 0 3 0 3 65535
27 1 0 0 3 0 3 65535
28 1 0 0 3 0 2 65535
29 1 0 0 3 0 2 65535
30 1 0 0 3 0 1 65535

Result: On frames 25, 27, and 29, EV01 attempts to step into the player, which triggers its collision code to run a set a move route on the player. On the next frame, the move route causes the players move speed to decrease by 1.

  1. Now move the event next to the water, try different move frequencies to see how long it waits to turn around.
move frequency wait to turn around
8 20
7 24
6 28
1 276

Result: Event waits for max_stop_count + 20 frames and then turns around

  1. Now set move_frequency=8, and surround EV01 with obstacles
Save EV01 stop count EV01 max stop count EV01 remaining step EV01 direction
1 1 4 0 2
4 4 4 0 2
20 20 4 0 2
60 60 4 0 2
61 1 4 0 3

Result: Event stays facing down until frame 61 where it forces itself to change direction.

@fdelapena fdelapena added this to the 0.6.x milestone Mar 2, 2019

@Ghabry Ghabry changed the title Horizontal / Vertical movement not right Horizontal / Vertical movement with "Collision Trigger" not right Mar 4, 2019

@fmatthew5876

This comment has been minimized.

Copy link
Contributor Author

commented Mar 5, 2019

This was merged, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.