Hi Drunk Viking Run,
I put together a small demo showing how the viking speeds up and has meads that go past you. I added a lot of comments so you see how it works. Press the right arrow key to move the viking. The viking is green and the meads are yellow. I hope this helps you out.
Here is the code:
Rem Project: Dark Basic Pro Project
Rem Created: Thursday, October 25, 2012
Rem ***** Main Source File *****
// Darkvee's example of very basic 2d runner
// It has a viking and meads
sync on
sync rate 60
// viking is green image color
ink rgb(0,255,0),0
box 0,0,10,10
get image 1,0,0,10,10
// mead is yellow image color
ink rgb(255,255,0),0
box 0,0,10,10
get image 2,0,0,10,10
// make 100 meads
for i = 1 to 100
meadX = meadX + i* 320
meadY = rnd(screen height()-1)
sprite i+1,meadX,meadY,2
next i
//viking
// viking number
vikingNum = 1
// viking position
vikingX = 50
vikingY = 320
//update position
sprite vikingNum,vikingX,vikingY,1
do
// if speedFlag = 1 then give our viking a speed boost
if speedFlag = 1
inc BoostSpeed
speedFlag = 0
endif
// press right arrow key to move the viking right
if rightkey()=1
// inc count this is are counter to speed up the viking
inc count
if count > 50 then count = 0
// if count is greater than 49 give our viking a speedBoost
if count > 49
speedFlag = 1
endif
// speed = our curretn viking speed.
speed = -1-BoostSpeed
endif
// NOTE: really though were not moving the viking were moving the meads .So it actually looks like the viking is moving.
// press up arrow key to move viking up
if upkey()=1
dec vikingY,4
endif
// press down arrow key to move viking down
if downkey()=1
inc vikingY,4
endif
//update the mead positions so it scrolls
for i = 1 to 100
meadX = sprite x(i+1)
meadY = sprite y(i+1)
sprite i+1,meadX+Speed,meadY,2
next i
// update viking position
sprite vikingNum,vikingX,vikingY,1
sync
loop
darkvee