Appolos Posted August 15, 2018 Share Posted August 15, 2018 Hello ! I created a group in my game, and I have arrows (left / right), and that's what I can not do: 1. I need to select only one element at a given time. 2. After pressing the left or right arrow, I need to move one element of the group to the next (for example, a slider). Please help to do this! Thanks !) Here is my code: this.rightArrow= this.add.sprite(game.config.width / 2+280, game.config.height/2,'rightArrow') .setScale(0.3) .setInteractive() .customParams = {direction:-1} this.left= this.add.sprite(game.config.width / 2-280, game.config.height/2,'rightArrow') .setScale(-0.3) .setInteractive() .customParams = {direction:1} let knifeData = [{ key: 'knife1', text: 'Areos', price: 100, }, { key: 'knife2', text: 'Winter', price: 100, }, { key: 'knife3', text: 'Scalpel', price: 100, }, { key: 'knife4', text: 'Hunting Knife', price: 100, }, { key: 'knife5', text: 'Bayonets', price: 100, } ] this.group = this.add.group(); knifeData.forEach(element => { this.group.create(game.config.width / 2, game.config.height / 2, element.key) this.group.create(game.config.width / 2, game.config.height / 2, element.key) this.group.create(game.config.width / 2, game.config.height / 2, element.key) this.group.create(game.config.width / 2, game.config.height / 2, element.key) this.group.create(game.config.width / 2, game.config.height / 2, element.key) }) Link to comment Share on other sites More sharing options...
Recommended Posts