conway220 Posted April 26, 2020 Share Posted April 26, 2020 Basically I have a card export default class Card { constructor(scene,x, y, sprite, text, player) { this.render = () => { let card = scene.add.image(x,y,sprite).setScale(0.2,0.2).setInteractive(); let cardText = scene.add.text(x- 75, y - 100,text).setFontSize(17).setColor('#000000').setInteractive(); cardText.setWordWrapWidth(160); card.on('pointerover', function () { card.y = card.y - 50; cardText.y = cardText.y - 50; }) card.on('pointerout', function() { card.y = card.y + 50; cardText.y = cardText.y + 50; }) card.on('pointerdown', function() { }) return card; } this.getPlayer = () => { return player; } } } and I then need to have functionality in my scene so that if it is clicked, I can call two methods in two classes, Player, and playZone, which aren't accessible by card.js. This will then move the card location and a few other things. I can't do the pointerdown in card.js as I need to be able to add the card object to the specific playZone. Hopefully this makes sense! I'm new to Javascript and I am far more familiar with Java. Link to comment Share on other sites More sharing options...
Recommended Posts