hi,
i have this class in src/scenes/cards/Deck.js
import { shuffle } from ‘lodash’;
export default class Deck {
constructor() {
let suits = [‘hearts’, ‘diamonds’, ‘clubs’, ‘spades’];
let ranks = [‘6’, ‘7’, ‘8’, ‘9’, ‘10’, ‘J’, ‘Q’, ‘K’, ‘A’];
let values = [6, 7, 8, 9, 10, 2, 3, 4, 11];
this.cards = [];
suits.forEach((suit) => {
ranks.forEach((rank, index) => {
this.cards.push({
suit,
rank,
value: values[index],
});
});
});
this.cards = shuffle(this.cards);
}
draw() {
return this.cards.pop();
/*
suit:"hearts"
rank:"Q"
value:3
*/
}
}
then i have SceneB.js in src/scenes/SceneB.js
import Deck from “./cards/Deck”;
class SceneB extends Phaser.Scene {
constructor() {
super(‘SceneB’);
}
init() {
console.log(‘Scene SceneB’);
}
preload() {
this.load.path = ‘./assets/’;
}
create() {
this.deck = new Deck();
}
update(time, delta) {
}
}
export default SceneB;
this is not working
this.deck = new Deck();
error
net::ERR_ABORTED 404 (Not Found)
how can i import Deck.js to work in SceneB
thanks a lot