Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
7be5540
Update main.blocks
sarveshcodes Jan 30, 2021
216b1fd
Update main.blocks, main.ts
sarveshcodes Jan 30, 2021
fcae5d8
Update pxt.json, images.g.jres, images.g.ts
sarveshcodes Jan 30, 2021
719d2b8
Update main.blocks, main.ts, images.g.jres, images.g.ts
sarveshcodes Jan 30, 2021
c9b7a4d
Update pxt.json, main.blocks, main.ts, images.g.jres, images.g.ts, ti…
sarveshcodes Jan 30, 2021
7d7ce7f
Update main.blocks, main.ts
sarveshcodes Jan 30, 2021
3b06cbc
Update main.blocks, main.ts
sarveshcodes Jan 30, 2021
3212b8d
Update pxt.json, main.blocks, main.ts, images.g.jres, images.g.ts, ma…
sarveshcodes Jan 30, 2021
ce0d1f8
Update main.blocks, images.g.jres, images.g.ts, tilemap.g.jres, tilem…
sarveshcodes Jan 30, 2021
9726c82
Update main.blocks, main.ts, images.g.jres, images.g.ts
sarveshcodes Jan 30, 2021
fcba3e1
Update main.blocks, main.ts, images.g.jres, images.g.ts, main.py
sarveshcodes Jan 30, 2021
b53d5c9
Restore '1/30/2021, 5:26:11 PM Update main.blocks, main.ts, images.g.…
sarveshcodes Jan 30, 2021
519fbd3
Update main.blocks, main.ts, images.g.jres, images.g.ts, tilemap.g.jr…
sarveshcodes Jan 30, 2021
3ee8ebc
Update main.blocks, main.ts, main.py
sarveshcodes Jan 30, 2021
c636468
Update main.blocks, main.ts, tilemap.g.jres, tilemap.g.ts, main.py
sarveshcodes Jan 30, 2021
53f19c5
Update main.blocks, main.ts, images.g.jres, images.g.ts, main.py
sarveshcodes Jan 30, 2021
0547504
Update images.g.jres, images.g.ts
sarveshcodes Jan 30, 2021
ea69766
Update pxt.json, main.blocks, main.ts, images.g.jres, images.g.ts, ti…
sarveshcodes Jan 30, 2021
d4150cb
Update main.blocks, main.ts
sarveshcodes Jan 31, 2021
50d2bc9
Update main.blocks, main.ts
sarveshcodes Jan 31, 2021
24c6952
Update main.blocks, main.ts, images.g.jres, images.g.ts, main.py
sarveshcodes Jan 31, 2021
1a99706
Update main.blocks, main.ts, images.g.jres, images.g.ts
sarveshcodes Jan 31, 2021
75549ef
Update main.blocks, main.ts, images.g.jres, images.g.ts, main.py
sarveshcodes Jan 31, 2021
74d9d34
Update main.blocks, main.ts, images.g.jres, images.g.ts, main.py
sarveshcodes Jan 31, 2021
4991f75
Update main.blocks, main.ts, images.g.jres, images.g.ts, tilemap.g.jr…
sarveshcodes Jan 31, 2021
2dcf7eb
Update main.blocks, main.ts
sarveshcodes Jan 31, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .github/makecode/blocks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .github/makecode/blocksdiff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
122 changes: 122 additions & 0 deletions images.g.jres

Large diffs are not rendered by default.

1,574 changes: 1,574 additions & 0 deletions images.g.ts

Large diffs are not rendered by default.

34 changes: 33 additions & 1 deletion main.blocks

Large diffs are not rendered by default.

119 changes: 119 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
def on_up_pressed():
global jumpcount
if jack.vy == 0:
jack.vy = -100
jumpcount = 1
elif jumpcount == 1:
jack.vy = -100
jumpcount += 2
controller.up.on_event(ControllerButtonEvent.PRESSED, on_up_pressed)

def on_on_overlap(sprite, coll1):
coll1.destroy()
statusbar.value += -30
sprites.on_overlap(SpriteKind.player, SpriteKind.projectile, on_on_overlap)

def on_a_pressed():
game.set_dialog_frame(img("""
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
"""))
game.set_dialog_text_color(5)
game.set_dialog_cursor(img("""
..............................
..............................
..............................
777777777777777777777777......
7......................7......
7.111.111.1111.111.111.7......
7.1...1.1.1..1.1...1...7......
7.111.111.1..1.1...111.7......
7...1.1...1111.1...1...7......
7.111.1...1..1.111.111.7......
7......................7......
777777777777777777777777......
..............................
..............................
..............................
"""))
game.show_long_text("Welcome To The world of retro.\\n Try to win as fast as possible.\\n press space to START GAME",
DialogLayout.CENTER)
controller.A.on_event(ControllerButtonEvent.PRESSED, on_a_pressed)

def on_overlap_tile(sprite, location):
game.over(True)
scene.on_overlap_tile(SpriteKind.player, sprites.builtin.brick, on_overlap_tile)

def on_life_zero():
info.set_score(0)
game.over(False, effects.confetti)
info.on_life_zero(on_life_zero)

def on_hit_wall(sprite, location):
coll1.destroy(effects.ashes, 100)
scene.on_hit_wall(SpriteKind.projectile, on_hit_wall)

coll1: Sprite = None
jumpcount = 0
statusbar: StatusBarSprite = None
jack: Sprite = None
scene.set_background_color(9)
tiles.set_tilemap(tilemap("""
level4
"""))
info.set_score(1000)
jack = sprites.create(assets.image("""
image6
"""), SpriteKind.player)
controller.move_sprite(jack, 100, 0)
info.set_life(3)
jack.ay = 250
scene.camera_follow_sprite(jack)
statusbar = statusbars.create(20, 4, StatusBarKind.energy)
statusbar.max = 100
statusbar.position_direction(CollisionDirection.LEFT)
statusbar.set_offset_padding(-40, 0)
test = sprites.all_of_kind(SpriteKind.player)
info.set_score(1000)

def on_on_update():
if jack.vx > 0:
jack.set_image(assets.image("""
image6
"""))
elif jack.vx < 0:
jack.set_image(assets.image("""
image7
"""))
game.on_update(on_on_update)

def on_on_update2():
pass
game.on_update(on_on_update2)

def on_update_interval():
global coll1
if game.runtime() > 3000:
coll1 = sprites.create_projectile_from_side(assets.image("""
image8
"""), -39, 50)
coll1.set_position(jack.x + 50, jack.y - 50)
game.on_update_interval(2000, on_update_interval)

def on_update_interval2():
info.set_score(info.score() - 5)
game.set_dialog_text_color(0)
game.on_update_interval(1000, on_update_interval2)
95 changes: 94 additions & 1 deletion main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,99 @@
controller.up.onEvent(ControllerButtonEvent.Pressed, function () {
if (jack.vy == 0) {
jack.vy = -100
jumpcount = 1
} else if (jumpcount == 1) {
jack.vy = -100
jumpcount += 2
}
})
sprites.onOverlap(SpriteKind.Player, SpriteKind.Projectile, function (sprite, coll1) {
coll1.destroy()
statusbar.value += -30
})
controller.A.onEvent(ControllerButtonEvent.Pressed, function () {

game.setDialogFrame(img`
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
`)
game.setDialogTextColor(5)
game.setDialogCursor(img`
..............................
..............................
..............................
777777777777777777777777......
7......................7......
7.111.111.1111.111.111.7......
7.1...1.1.1..1.1...1...7......
7.111.111.1..1.1...111.7......
7...1.1...1111.1...1...7......
7.111.1...1..1.111.111.7......
7......................7......
777777777777777777777777......
..............................
..............................
..............................
`)
game.showLongText("Welcome To The world of retro.\\n Try to win as fast as possible.\\n press space to START GAME", DialogLayout.Center)
})
scene.onOverlapTile(SpriteKind.Player, sprites.builtin.brick, function (sprite, location) {
game.over(true)
})
info.onLifeZero(function () {
info.setScore(0)
game.over(false, effects.confetti)
})
scene.onHitWall(SpriteKind.Projectile, function (sprite, location) {
coll1.destroy(effects.ashes, 100)
})
let coll1: Sprite = null
let jumpcount = 0
let statusbar: StatusBarSprite = null
let jack: Sprite = null
tiles.setTilemap(tilemap`level4`)
scene.setBackgroundColor(9)
info.setScore(1000)
jack = sprites.create(assets.image`image6`, SpriteKind.Player)
controller.moveSprite(jack, 100, 0)
info.setLife(3)
jack.ay = 250
scene.cameraFollowSprite(jack)
statusbar = statusbars.create(20, 4, StatusBarKind.Energy)
statusbar.max = 100
statusbar.positionDirection(CollisionDirection.Left)
statusbar.setOffsetPadding(-40, 0)
let test = sprites.allOfKind(SpriteKind.Player)
info.setScore(1000)
game.onUpdate(function () {
if (jack.vx > 0) {
jack.setImage(assets.image`image6`)
} else if (jack.vx < 0) {
jack.setImage(assets.image`image7`)
}
})
game.onUpdate(function () {

})
game.onUpdateInterval(2000, function () {
if (game.runtime() > 3000) {
coll1 = sprites.createProjectileFromSide(assets.image`image8`, -39, 50)
coll1.setPosition(jack.x + 50, jack.y - 50)
}
})
game.onUpdateInterval(1000, function () {
info.setScore(info.score() - 5)
game.setDialogTextColor(0)
})
10 changes: 8 additions & 2 deletions pxt.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@
"name": "SwampHackGame",
"description": "",
"dependencies": {
"device": "*"
"device": "*",
"pxt-status-bar": "github:jwunderl/pxt-status-bar#v0.4.0"
},
"files": [
"main.blocks",
"main.ts",
"README.md",
"assets.json"
"assets.json",
"images.g.jres",
"images.g.ts",
"tilemap.g.jres",
"tilemap.g.ts",
"main.py"
],
"testFiles": [
"test.ts"
Expand Down
Loading