initialSpawnTimer = 200
gravity = 1
gameSpeed = 3
spawnTimer = initialSpawnTimer
score = 0
gameOver = false
player.x = 100
player.y = 0
player.w = 50
player.h = 50
player.originalHeight = player.h
player.c
= RGB32(255, 0, 0) player.jumpForce = 10
player.grounded = false
update
spawnTimer = spawnTimer - 1
spawnObstacle
spawnTimer = initialSpawnTimer - gameSpeed * 8
spawnTimer = 60
IF obstacles
(i
).state
= true
THEN IF obstacles
(i
).x
+ obstacles
(i
).w
< 0 THEN obstacles(i).state = false
IF player.x
< obstacles
(i
).x
+ obstacles
(i
).w
AND _
player.x
+ player.w
> obstacles
(i
).x
AND _
player.y
< obstacles
(i
).y
+ obstacles
(i
).h
AND _
player.y
+ player.h
> obstacles
(i
).y
THEN gameOver = true
updateObstacle i
animate player
score = score + 1
t
= "Score:" + STR$(score
)
highScore = score
t
= "Highscore:" + STR$(highScore
)
gameSpeed = gameSpeed + .003
obstacles(i).x = obstacles(i).x + obstacles(i).dx
drawit obstacles(i)
obstacles(i).dx = -gameSpeed
IF obstacles
(i
).state
= false
THEN obstacles(i).index = i
obstacles(i).state = true
size = rand(20, 70)
kind = rand(0, 1)
obstacles
(i
).x
= WIDTH + size
obstacles
(i
).y
= HEIGHT - size
obstacles(i).w = size
obstacles(i).h = size
obstacles
(i
).c
= RGB32(83, 50, 194)
obstacles(i).y = obstacles(i).y - player.originalHeight + 10
SUB animate
(this
AS Actor
) jump this
this.jumpTimer = 0
this.h = this.originalHeight / 2
this.h = this.originalHeight
this.y = this.y + this.dy
'gravity
this.dy = this.dy + gravity
this.grounded = false
this.dy = 0
this.grounded = true
drawit this
this.jumpTimer = 1
this.dy = -this.jumpForce
this.jumpTimer = this.jumpTimer + 1
this.dy = -this.jumpForce - (this.jumpTimer / 50)
SUB drawit
(this
AS Actor
) LINE (this.x
, this.y
)-STEP(this.w
, this.h
), this.c
, BF