Skip to content

Commit

Permalink
Create AB_3_BoulderMadness.md (#479)
Browse files Browse the repository at this point in the history
Give the boulders colours to easily differentiate between good and bad ones.
  • Loading branch information
kedilayanaveen10 authored Jan 14, 2022
1 parent 564910e commit 54f4b45
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions solutions/bonus/AB_3_BoulderMadness.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# AB_3_BoulderMadness.md
## kedilayanaveen10: Colour the boulders
Give the boulders colours to easily differentiate between good and bad ones.

```javascript
map.defineObject('boulder', {
//let it be default colour
'symbol': String.fromCharCode(0x2617),
'impassable': true
});

map.defineObject('movingBoulder', {
'color': 'green',
'symbol': String.fromCharCode(0x2617),
'pushable': true,
'type': 'dynamic',
});

map.defineObject('trapBoulder', {
'color': 'red',
'symbol': String.fromCharCode(0x2617),
'pushable': true,
'type': 'dynamic',
'onCollision': function (player) {
player.killedBy('Got trapped under boulder');
},
});
```

0 comments on commit 54f4b45

Please sign in to comment.