Initial files for MakeCode project

This commit is contained in:
Justin Oros
2020-05-29 14:56:50 -07:00
parent d13d2d1e11
commit 0e90b07d87
10 changed files with 266 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
name: MakeCode
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [8.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install
run: |
npm install -g pxt
pxt target arcade
- name: build
run: |
pxt install
pxt build --cloud
env:
CI: true
+23
View File
@@ -0,0 +1,23 @@
{
"editor.formatOnType": true,
"files.autoSave": "afterDelay",
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/built/**": true,
"**/node_modules/**": true,
"**/yotta_modules/**": true,
"**/yotta_targets": true,
"**/pxt_modules/**": true
},
"files.associations": {
"*.blocks": "html",
"*.jres": "json"
},
"search.exclude": {
"**/built": true,
"**/node_modules": true,
"**/yotta_modules": true,
"**/yotta_targets": true,
"**/pxt_modules": true
}
}
+36
View File
@@ -0,0 +1,36 @@
// A task runner that calls the MakeCode (PXT) compiler
{
"version": "2.0.0",
"tasks": [{
"label": "pxt deploy",
"type": "shell",
"command": "pxt deploy --local",
"group": "build",
"problemMatcher": [ "$tsc" ]
}, {
"label": "pxt build",
"type": "shell",
"command": "pxt build --local",
"group": "build",
"problemMatcher": [ "$tsc" ]
}, {
"label": "pxt install",
"type": "shell",
"command": "pxt install",
"group": "build",
"problemMatcher": [ "$tsc" ]
}, {
"label": "pxt clean",
"type": "shell",
"command": "pxt clean",
"group": "test",
"problemMatcher": [ "$tsc" ]
}, {
"label": "pxt serial",
"type": "shell",
"command": "pxt serial",
"group": "test",
"problemMatcher": [ "$tsc" ]
}]
}
+10
View File
@@ -0,0 +1,10 @@
all: deploy
build:
pxt build
deploy:
pxt deploy
test:
pxt test
+34
View File
@@ -0,0 +1,34 @@
# baby-yoda-vs-tie-fighters ![Build status badge](https://github.com/justinoros/baby-yoda-vs-tie-fighters/workflows/MakeCode/badge.svg)
## Use this extension
This repository can be added as an **extension** in MakeCode.
* open https://arcade.makecode.com/
* click on **New Project**
* click on **Extensions** under the gearwheel menu
* search for the URL of this repository and import
## Edit this extension
To edit this repository in MakeCode.
* open https://arcade.makecode.com/
* click on **Import** then click on **Import URL**
* paste the repository URL and click import
## Blocks preview
This image shows the blocks code from the last commit in master.
This image may take a few minutes to refresh.
![A rendered view of the blocks](https://github.com/justinoros/baby-yoda-vs-tie-fighters/raw/master/.makecode/blocks.png)
## Supported targets
* for PXT/arcade
* for PXT/arcade
(The metadata above is needed for package search.)
+45
View File
@@ -0,0 +1,45 @@
<xml xmlns="https://developers.google.com/blockly/xml"><variables><variable type="KIND_SpriteKind" id="*q7{Qkgn6e2%{ia9Pg^t">Player</variable><variable type="KIND_SpriteKind" id="H/cK8Q4/lo)RGryfc;m0">Projectile</variable><variable type="KIND_SpriteKind" id="muMXJQx^8J($ORC__TxQ">Food</variable><variable type="KIND_SpriteKind" id="h7-ld9A[VX.1O(+c}AAS">Enemy</variable><variable id="*^zA_H8~{Hpb+Y34RW%r">babyYoda</variable><variable id="3RY#aiZc)5fV33wE+49`">bogey</variable><variable id="WYQFO,!3eo@:5f?gY%](">projectile</variable><variable id="2rfHk#x]#z(^)Q?2fwAS">bullet</variable><variable id="Q0]c8Cha(^sS7OM5PDN:">otherSprite</variable><variable id="}qgE@H11/-?7G?n$Ftc/">sprite</variable></variables><block type="pxt-on-start" x="0" y="0"><statement name="HANDLER"><block type="variables_set"><field name="VAR" id="*^zA_H8~{Hpb+Y34RW%r">babyYoda</field><value name="VALUE"><shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number"><field name="NUM">0</field></shadow><block type="spritescreate"><value name="img"><shadow type="screen_image_picker"><field name="img">img`
. . . b b b b b . 7 7 7 . . . .
. . b b d d c . 7 7 7 7 7 . . .
. b b d d b . 7 7 7 c c c . . .
. b d d b c 7 7 7 7 7 c c . . .
b b d d c . 7 7 7 7 7 7 7 . . .
b d d d b 7 7 7 7 e e 7 7 . . .
b b d d c 7 . . e e e e e . . .
. b b b b . . . 7 7 7 e e . . .
b b d b c b c b 7 7 f f f b c b
b d d d b d d d d 7 f d d d d b
b b d b b b b b b b b b b b b b
. b b b d d d d d d d d d d b .
. . b d d d d d d d d d d d b .
. . b b b d d d d d d d b b b .
. . . . b b d d d d d b b . . .
. . . . . b b b b b b b . . . .
`</field></shadow></value><value name="kind"><shadow type="spritekind"><field name="MEMBER">Player</field></shadow></value></block></value><next><block type="spritesetsetflag"><field name="flag">SpriteFlag.StayInScreen</field><value name="sprite"><block type="variables_get"><field name="VAR" id="*^zA_H8~{Hpb+Y34RW%r">babyYoda</field></block></value><value name="on"><shadow type="toggleOnOff"><field name="on">true</field></shadow></value><next><block type="hudSetLife"><value name="value"><shadow type="math_number"><field name="NUM">3</field></shadow></value><next><block type="game_control_sprite"><mutation xmlns="http://www.w3.org/1999/xhtml" _expanded="2" _input_init="true"></mutation><value name="sprite"><block type="variables_get"><field name="VAR" id="*^zA_H8~{Hpb+Y34RW%r">babyYoda</field></block></value><value name="vx"><shadow type="math_number"><field name="NUM">200</field></shadow></value><value name="vy"><shadow type="math_number"><field name="NUM">200</field></shadow></value></block></next></block></next></block></next></block></statement></block><block type="spritesoverlap" x="750" y="30"><value name="HANDLER_DRAG_PARAM_sprite"><shadow type="argument_reporter_custom"><mutation typename="Sprite"/><field name="VALUE">sprite</field></shadow></value><value name="kind"><shadow type="spritekind"><field name="MEMBER">Player</field></shadow></value><value name="HANDLER_DRAG_PARAM_otherSprite"><shadow type="argument_reporter_custom"><mutation typename="Sprite"/><field name="VALUE">otherSprite</field></shadow></value><value name="otherKind"><shadow type="spritekind"><field name="MEMBER">Enemy</field></shadow></value><statement name="HANDLER"><block type="spritedestroy"><mutation xmlns="http://www.w3.org/1999/xhtml" _expanded="0" _input_init="false"></mutation><value name="sprite"><block type="variables_get"><field name="VAR" id="Q0]c8Cha(^sS7OM5PDN:">otherSprite</field></block></value><next><block type="hudChangeLifeBy"><value name="value"><shadow type="math_number"><field name="NUM">-1</field></shadow></value></block></next></block></statement></block><block type="keyonevent" x="10" y="310"><field name="button">controller.A</field><field name="event">ControllerButtonEvent.Pressed</field><statement name="HANDLER"><block type="variables_set"><field name="VAR" id="2rfHk#x]#z(^)Q?2fwAS">bullet</field><value name="VALUE"><shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number"><field name="NUM">0</field></shadow><block type="spritescreateprojectilefromsprite"><value name="img"><shadow type="screen_image_picker"><field name="img">img`
. . . .
. . . .
4 4 5 5
. . . .
`</field></shadow><block type="screen_image_picker"><field name="img">img`
. . . .
. . . .
5 5 5 5
. . . .
`</field></block></value><value name="sprite"><block type="variables_get"><field name="VAR" id="*^zA_H8~{Hpb+Y34RW%r">babyYoda</field></block></value><value name="vx"><shadow type="spriteSpeedPicker"><field name="speed">200</field></shadow></value><value name="vy"><shadow type="spriteSpeedPicker"><field name="speed">0</field></shadow></value></block></value></block></statement></block><block type="spritesoverlap" x="730" y="290"><value name="HANDLER_DRAG_PARAM_sprite"><shadow type="argument_reporter_custom"><mutation typename="Sprite"/><field name="VALUE">sprite</field></shadow></value><value name="kind"><shadow type="spritekind"><field name="MEMBER">Projectile</field></shadow></value><value name="HANDLER_DRAG_PARAM_otherSprite"><shadow type="argument_reporter_custom"><mutation typename="Sprite"/><field name="VALUE">otherSprite</field></shadow></value><value name="otherKind"><shadow type="spritekind"><field name="MEMBER">Enemy</field></shadow></value><statement name="HANDLER"><block type="spritedestroy"><mutation xmlns="http://www.w3.org/1999/xhtml" _expanded="0" _input_init="false"></mutation><value name="sprite"><block type="variables_get"><field name="VAR" id="Q0]c8Cha(^sS7OM5PDN:">otherSprite</field></block></value><next><block type="spritedestroy"><mutation xmlns="http://www.w3.org/1999/xhtml" _expanded="2" _input_init="true"></mutation><field name="effect">effects.fire</field><value name="sprite"><block type="variables_get"><field name="VAR" id="}qgE@H11/-?7G?n$Ftc/">sprite</field></block></value><value name="duration"><shadow type="timePicker"><field name="ms">100</field></shadow></value><next><block type="hudChangeScoreBy"><value name="value"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block></next></block></next></block></statement></block><block type="gameinterval" x="10" y="470"><value name="period"><shadow type="timePicker"><field name="ms">500</field></shadow></value><statement name="HANDLER"><block type="variables_set"><field name="VAR" id="3RY#aiZc)5fV33wE+49`">bogey</field><value name="VALUE"><shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number"><field name="NUM">0</field></shadow><block type="spritescreate"><value name="img"><shadow type="screen_image_picker"><field name="img">img`
. . . . . . . . . . . . . . . .
. . . . . . . b b b b b b b . .
. . . . . . b b c b c c c c b b
. . . . . b b c c b c c c c c b
. b b b b c c c b c c c c c c b
b c c c c c c c b c c c c c b b
b b b b b b b b b b b b b b b .
. . . . . . . b 1 b b c c c b b
. . . . . . b b c b c c c c c b
. . . . . . . b 1 b b c c c b b
b b b b b b b b b b b b b b b .
b c c c c c c c b c c c c c b b
. b b b b c c c b c c c c c c b
. . . . . b b c c b c c c c c b
. . . . . . b b c b c c c b b b
. . . . . . . b b b b b b b . .
`</field></shadow></value><value name="kind"><shadow type="spritekind"><field name="MEMBER">Enemy</field></shadow></value></block></value><next><block type="spritesetvel"><value name="sprite"><block type="variables_get"><field name="VAR" id="3RY#aiZc)5fV33wE+49`">bogey</field></block></value><value name="vx"><shadow type="spriteSpeedPicker"><field name="speed">-100</field></shadow></value><value name="vy"><shadow type="spriteSpeedPicker"><field name="speed">0</field></shadow></value><next><block type="spritesetpos"><value name="sprite"><block type="variables_get"><field name="VAR" id="3RY#aiZc)5fV33wE+49`">bogey</field></block></value><value name="x"><shadow type="positionPicker"><field name="index">180</field></shadow></value><value name="y"><shadow type="positionPicker"><field name="index">120</field></shadow><block type="device_random"><value name="min"><shadow type="math_number"><field name="NUM">0</field></shadow></value><value name="limit"><shadow type="math_number"><field name="NUM">120</field></shadow></value></block></value></block></next></block></next></block></statement></block></xml>
+63
View File
@@ -0,0 +1,63 @@
sprites.onOverlap(SpriteKind.Projectile, SpriteKind.Enemy, function (sprite, otherSprite) {
otherSprite.destroy()
sprite.destroy(effects.fire, 100)
info.changeScoreBy(1)
})
controller.A.onEvent(ControllerButtonEvent.Pressed, function () {
bullet = sprites.createProjectileFromSprite(img`
. . . .
. . . .
5 5 5 5
. . . .
`, babyYoda, 200, 0)
})
sprites.onOverlap(SpriteKind.Player, SpriteKind.Enemy, function (sprite, otherSprite) {
otherSprite.destroy()
info.changeLifeBy(-1)
})
let bogey: Sprite = null
let bullet: Sprite = null
let babyYoda: Sprite = null
babyYoda = sprites.create(img`
. . . b b b b b . 7 7 7 . . . .
. . b b d d c . 7 7 7 7 7 . . .
. b b d d b . 7 7 7 c c c . . .
. b d d b c 7 7 7 7 7 c c . . .
b b d d c . 7 7 7 7 7 7 7 . . .
b d d d b 7 7 7 7 e e 7 7 . . .
b b d d c 7 . . e e e e e . . .
. b b b b . . . 7 7 7 e e . . .
b b d b c b c b 7 7 f f f b c b
b d d d b d d d d 7 f d d d d b
b b d b b b b b b b b b b b b b
. b b b d d d d d d d d d d b .
. . b d d d d d d d d d d d b .
. . b b b d d d d d d d b b b .
. . . . b b d d d d d b b . . .
. . . . . b b b b b b b . . . .
`, SpriteKind.Player)
babyYoda.setFlag(SpriteFlag.StayInScreen, true)
info.setLife(3)
controller.moveSprite(babyYoda, 200, 200)
game.onUpdateInterval(500, function () {
bogey = sprites.create(img`
. . . . . . . . . . . . . . . .
. . . . . . . b b b b b b b . .
. . . . . . b b c b c c c c b b
. . . . . b b c c b c c c c c b
. b b b b c c c b c c c c c c b
b c c c c c c c b c c c c c b b
b b b b b b b b b b b b b b b .
. . . . . . . b 1 b b c c c b b
. . . . . . b b c b c c c c c b
. . . . . . . b 1 b b c c c b b
b b b b b b b b b b b b b b b .
b c c c c c c c b c c c c c b b
. b b b b c c c b c c c c c c b
. . . . . b b c c b c c c c c b
. . . . . . b b c b c c c b b b
. . . . . . . b b b b b b b . .
`, SpriteKind.Enemy)
bogey.setVelocity(-100, 0)
bogey.setPosition(180, Math.randomRange(0, 120))
})
+16
View File
@@ -0,0 +1,16 @@
{
"name": "Baby Yoda vs Tie Fighters!",
"dependencies": {
"device": "*"
},
"description": "",
"files": [
"main.blocks",
"main.ts",
"README.md"
],
"preferredEditor": "blocksprj",
"testFiles": [
"test.ts"
]
}
+1
View File
@@ -0,0 +1 @@
// tests go here; this will not be compiled when this package is used as an extension.
+9
View File
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"target": "es5",
"noImplicitAny": true,
"outDir": "built",
"rootDir": "."
},
"exclude": ["pxt_modules/**/*test.ts"]
}