Skip to content

Commit

Permalink
New jump option: dont_play_jump_animation
Browse files Browse the repository at this point in the history
  • Loading branch information
jjppof committed Mar 15, 2024
1 parent 598baa6 commit 957f456
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 3 additions & 1 deletion base/ControllableChar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,8 @@ export abstract class ControllableChar {
bounce?: boolean;
/** Whether the char shadow will remain hidden after jump. */
keep_shadow_hidden?: boolean;
/** If true, char jump animation won't be played. */
dont_play_jump_animation?: boolean;
}) {
const duration = options?.duration ?? 65;
const jump_height = options?.jump_height ?? 12;
Expand Down Expand Up @@ -952,7 +954,7 @@ export abstract class ControllableChar {
}
this.toggle_collision(false);
this.jumping = true;
if (this.sprite_info.hasAction(base_actions.JUMP)) {
if (this.sprite_info.hasAction(base_actions.JUMP) && !options.dont_play_jump_animation) {
let jump_init_resolve;
const jump_init_promise = new Promise(resolve => (jump_init_resolve = resolve));
this.play(base_actions.JUMP, reverse_directions[jump_direction]);
Expand Down
3 changes: 2 additions & 1 deletion base/game_events/GameEventManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,8 @@ export class GameEventManager {
info.dest,
info.jump_direction,
info.sfx_key,
info.wait_after
info.wait_after,
info.dont_play_jump_animation
);
case event_types.FACE_DIRECTION:
return new FaceDirectionEvent(
Expand Down
6 changes: 5 additions & 1 deletion base/game_events/JumpEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export class JumpEvent extends GameEvent {
distance?: number;
};
private jump_direction: directions;
private dont_play_jump_animation: boolean;
private sfx_key: string;
private finish_events: GameEvent[];

Expand All @@ -36,7 +37,8 @@ export class JumpEvent extends GameEvent {
dest,
jump_direction,
sfx_key,
wait_after
wait_after,
dont_play_jump_animation
) {
super(game, data, event_types.JUMP, active, key_name, keep_reveal, keep_custom_psynergy);
this.is_npc = is_npc;
Expand All @@ -48,6 +50,7 @@ export class JumpEvent extends GameEvent {
this.dest = dest;
this.jump_direction = jump_direction !== undefined ? directions[jump_direction as string] : undefined;
this.sfx_key = sfx_key;
this.dont_play_jump_animation = dont_play_jump_animation;
this.finish_events = [];
if (finish_events !== undefined) {
finish_events.forEach(event_info => {
Expand Down Expand Up @@ -81,6 +84,7 @@ export class JumpEvent extends GameEvent {
dest: this.dest,
time_on_finish: this.wait_after,
sfx_key: this.sfx_key,
dont_play_jump_animation: this.dont_play_jump_animation,
});

char.force_char_stop_in_event = previous_force_char_stop_in_event;
Expand Down

0 comments on commit 957f456

Please sign in to comment.