Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- https://makecode.com/_WHWfz91Lc5eR
- https://sites.google.com/site/akulcsarsite/makecode/makecode-arcade
- enum SpriteKindLegacy {
- Player,
- Projectile,
- Food,
- Enemy
- }
- controller.left.onEvent(ControllerButtonEvent.Pressed, function () {
- grid.moveLeft(mySprite)
- })
- controller.down.onEvent(ControllerButtonEvent.Pressed, function () {
- grid.moveDown(mySprite, false)
- })
- controller.B.onEvent(ControllerButtonEvent.Pressed, function () {
- rows += 1
- setGridSize()
- drawGrid()
- })
- function drawGrid () {
- grid.drawGrid(bg, 7)
- }
- controller.A.onEvent(ControllerButtonEvent.Pressed, function () {
- columns += 1
- setGridSize()
- drawGrid()
- })
- controller.right.onEvent(ControllerButtonEvent.Pressed, function () {
- grid.moveRight(mySprite, false)
- })
- function setGridSize () {
- grid.setSize(rows, columns)
- grid.setSpriteLocation(mySprite, 0, 0)
- }
- controller.up.onEvent(ControllerButtonEvent.Pressed, function () {
- grid.moveUp(mySprite)
- })
- let rows = 0
- let columns = 0
- let bg: Image = null
- let mySprite: Sprite = null
- mySprite = sprites.create(img`
- . . . . . . . e e e e . . . . .
- . . . . . e e 4 5 5 5 e e . . .
- . . . . e 4 5 6 2 2 7 6 6 e . .
- . . . e 5 6 6 7 2 2 6 4 4 4 e .
- . . e 5 2 2 7 6 6 4 5 5 5 5 4 .
- . e 5 6 2 2 8 8 5 5 5 5 5 4 5 4
- . e 5 6 7 7 8 5 4 5 4 5 5 5 5 4
- e 4 5 8 6 6 5 5 5 5 5 5 4 5 5 4
- e 5 c e 8 5 5 5 4 5 5 5 5 5 5 4
- e 5 c c e 5 4 5 5 5 4 5 5 5 e .
- e 5 c c 5 5 5 5 5 5 5 5 4 e . .
- e 5 e c 5 4 5 4 5 5 5 e e . . .
- e 5 e e 5 5 5 5 5 4 e . . . . .
- 4 5 4 e 5 5 5 5 e e . . . . . .
- . 4 5 4 5 5 4 e . . . . . . . .
- . . 4 4 e e e . . . . . . . . .
- `, SpriteKindLegacy.Player)
- bg = image.create(scene.screenWidth(), scene.screenHeight())
- columns = 4
- rows = 3
- scene.setBackgroundImage(bg)
- grid.allowWrap(true)
- grid.setSpriteVelocity(150)
- setGridSize()
- drawGrid()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement