Skip to content

Commit

Permalink
Merge branch 'main' of github.com:JoeStrout/spider-pig
Browse files Browse the repository at this point in the history
  • Loading branch information
Armen committed Aug 12, 2024
2 parents 3050b29 + 72358b4 commit 79c97df
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 4 deletions.
3 changes: 1 addition & 2 deletions displays.ms
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
initialized = false

setup = function
clear
// Far background (sky)
display(7).mode = displayMode.solidColor
outer.sky = display(7)
Expand Down Expand Up @@ -43,7 +42,7 @@ setup = function
text.clear

// Frontmost layer: curtain (also used for QA etc.)
display(0).mode = displayMode.off // for now!
//display(0).mode = displayMode.off // for now!

outer.initialized = true
end function
Expand Down
38 changes: 38 additions & 0 deletions loadingScreen.ms
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import "importUtil"
ensureImport "displays"

BARLEFT = 440
BARWIDTH = 315
BARBOTTOM = 275
BARHEIGHT = 20

drawBar = function(fractionDone = 0.5)
g = display(0)
g.fillRect BARLEFT, BARBOTTOM, BARWIDTH, BARHEIGHT, "#000088"
g.fillRect BARLEFT, BARBOTTOM, BARWIDTH*fractionDone, BARHEIGHT, "#44FF44"
g.drawRect BARLEFT, BARBOTTOM, BARWIDTH, BARHEIGHT, "#CCCCFF", 3
end function

begin = function
display(0).mode = displayMode.pixel
g = display(0)
for alpha in range(0, 255, 10)
g.clear color.rgba(0, 0, 0, alpha)
yield
end for
g.clear color.black
img = file.loadImage("pics/Loading.png")
g.drawImage img, 480-img.width/2, 320-img.height/2
drawBar 0
end function

fadeOut = function
g = display(0)
for alpha in range(255, 0, -10)
g.clear color.rgba(0, 0, 0, alpha)
yield
end for
display(0).mode = displayMode.off
end function


25 changes: 23 additions & 2 deletions main.ms
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import "importUtil"

ensureImport "loadingScreen"
loadingScreen.begin

ensureImport "sounds"
ensureImport "mathUtil"
ensureImport "gameInput"
Expand All @@ -11,11 +15,16 @@ ensureImport "newspaper"
ensureImport "ufo"
ensureImport "background"

loadingScreen.drawBar 0.1
displays.setup
sounds.setup
loadingScreen.drawBar 0.2
background.setup
loadingScreen.drawBar 0.3
minimap.setup
loadingScreen.drawBar 0.4
ufo.setup
loadingScreen.drawBar 0.5

gameOver = false

Expand All @@ -24,12 +33,15 @@ CHEATS_ENABLED = true
// load background
import "buildings"
buildings.setup
loadingScreen.drawBar 0.8
playerMgr.setup
loadingScreen.drawBar 0.9

gravity = 10000 // pixels/sec^2
camera = {"x": 480, "y": 320}

pickups.setup
loadingScreen.drawBar 1

dot = function(ax,ay, bx,by)
return ax*bx + ay*by
Expand Down Expand Up @@ -160,12 +172,21 @@ end function
//bg.scale *= 2
//buildingRef.scaleFactor = bg.scale

updateCamera
loadingScreen.fadeOut

wasDown = mouse.button
prevTime = time
while not gameOver
curTime = time
dt = curTime - prevTime
prevTime = curTime
if dt > 0.02 then dt = 0.02

eraseWeb
playerMgr.updatePlayer
playerMgr.updatePlayer dt
playerMgr.handleInput
updateCamera
updateCamera
drawWeb
minimap.update pickups.Powerup.all
pickups.updateAll
Expand Down
Binary file added pics/Loading.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 added pics/SpiderPig-mugshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 79c97df

Please sign in to comment.