How do I make a simple "tile-matching" game? #269
Unanswered
jbaicoianu
asked this question in
FAQs
Replies: 1 comment
-
(NOTE - work in progress)We'll start off by defining a custom element to act as our game board. // <matching-game> represents an instance of the game board
room.registerElement('matching-game', {
rows: 5,
cols: 5,
tilesize: .5,
tileshape: 'cube',
tilespacing: 1.1,
create() {
this.createFrame();
this.createGrid();
this.reset();
},
createFrame() {
},
createGrid() {
},
reset() {
}
});
// <matching-game-tile> represents a "tile" within the game board.
// Each tile could be a colored square, sphere, gem, etc.
room.registerElement('matching-game-tile', {
x: -1,
y: -1,
shape: 'sphere',
size: .5,
create() {
this.tile = this.createObject('object', {
id: this.shape,
collision_id: this.shape,
scale: V(this.size),
});
this.tile.addEventListener('click', ev => this.handleClick(ev));
},
handleClick(ev) {
}
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How would one go about making a simple tile-matching game - something like Bejeweled or Candy Crush?
Beta Was this translation helpful? Give feedback.
All reactions