Skip to content

Commit

Permalink
fix: Allow actor args on Triggers
Browse files Browse the repository at this point in the history
  • Loading branch information
eonarheim committed Sep 9, 2024
1 parent f34078c commit fa62f5a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).

### Added

- `ex.Trigger` now supports all valid actor constructor parameters from `ex.ActorArgs` in addition to `ex.TriggerOptions`
- `ex.Gif` can now handle default embedded GIF frame timings
- New `ex.Screen.worldToPagePixelRatio` API that will return the ratio between excalibur pixels and the HTML pixels.
* Additionally excalibur will now decorate the document root with this same value as a CSS variable `--ex-pixel-ratio`
Expand Down
6 changes: 3 additions & 3 deletions src/engine/Trigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Vector } from './Math/vector';
import { ExitTriggerEvent, EnterTriggerEvent, CollisionEndEvent, CollisionStartEvent } from './Events';
import { CollisionType } from './Collision/CollisionType';
import { Entity } from './EntityComponentSystem';
import { Actor, ActorEvents } from './Actor';
import { Actor, ActorArgs, ActorEvents } from './Actor';
import { EventEmitter } from './EventEmitter';

export type TriggerEvents = ActorEvents & {
Expand Down Expand Up @@ -62,8 +62,8 @@ export class Trigger extends Actor {
/**
* @param options Trigger options
*/
constructor(options: Partial<TriggerOptions>) {
super({ x: options.pos?.x, y: options.pos?.y, width: options.width, height: options.height });
constructor(options: Partial<TriggerOptions> & ActorArgs) {
super({ ...options });

this.filter = options.filter ?? (() => true);
this.repeat = options.repeat ?? -1;
Expand Down

0 comments on commit fa62f5a

Please sign in to comment.