You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to make a method that crushes other characters while sliding Koopa, but the sound effect works more than once when hitting characters. How can I prevent this?
`import Entity from '../Entity.js';
import { Trait } from '../Trait.js';
import Killable from '../traits/Killable.js';
import PendulumMove from '../traits/PendulumMove.js';
import Physics from '../traits/Physics.js';
import Solid from '../traits/Solid.js';
import Screamer from '../traits/Screamer.js';
import { loadAudioBoard } from '../loaders/audio.js';
import { loadSpriteSheet } from '../loaders.js';
I tried to make a method that crushes other characters while sliding Koopa, but the sound effect works more than once when hitting characters. How can I prevent this?
`import { Trait } from '../Trait.js';
export default class Screamer extends Trait {
constructor() {
super('screamer');
}
async collides(us, them) {
if (!them.killable.screaming) {
return;
}
if (them.vel.x < us.vel.x) {
this.sounds.add('fireworks');
await this.events.emit('scream', us, them);
}
}
`}``
`import Entity from '../Entity.js';
import { Trait } from '../Trait.js';
import Killable from '../traits/Killable.js';
import PendulumMove from '../traits/PendulumMove.js';
import Physics from '../traits/Physics.js';
import Solid from '../traits/Solid.js';
import Screamer from '../traits/Screamer.js';
import { loadAudioBoard } from '../loaders/audio.js';
import { loadSpriteSheet } from '../loaders.js';
export function loadKoopa(audioContext) {
return Promise.all([
loadSpriteSheet('koopa'),
loadAudioBoard('koopa', audioContext),
])
.then(([sprite, audio]) => {
return createKoopaFactory(sprite, audio);
});
}
const STATE_WALKING = Symbol('walking');
const STATE_HIDING = Symbol('hiding');
const STATE_PANIC = Symbol('panic');
class Behavior extends Trait {
constructor() {
super('behavior');
}
function createKoopaFactory(sprite, audio) {
const walkAnim = sprite.animations.get('walk');
const wakeAnim = sprite.animations.get('wake');
}
`
The text was updated successfully, but these errors were encountered: