It is different to the "Roll out the barrel" thread example in that the hot spots return the tile ID not a boolean on transparent color or not.
Thus the background is based on an array of tile images although the characters have pixel accurate positions.
You must run this code to generate the bitmaps used ...
Code: Select all
screenres 640,480,32
color rgb(0,0,0),rgb(255,255,255):cls
dim as any ptr image
image = imagecreate( 60, 100)
dim as ulong colors( 9)
colors( 0)=RGB(255,0,255)
colors( 1)=RGB(128,0,0)
colors( 2)=RGB(136,0,21)
colors( 3)=RGB(248,184,160)
colors( 4)=RGB(0,0,0)
colors( 5)=RGB(160,32,64)
colors( 6)=RGB(34,177,76)
colors( 7)=RGB(255,174,201)
colors( 8)=RGB(255,255,255)
dim as integer n
for j as integer = 0 to 99
for i as integer = 0 to 59
read n
pset image,(i,j),colors(n)
next i
next j
bsave "littleGuysA.bmp",image
put (0,0),image,trans
sleep
dim shared as any ptr guards
guards = imagecreate(60,100)
bload "littleGuysA.bmp",guards
for j as integer = 0 to 99
for i as integer = 0 to 59
if point(i,j,guards)<>rgb(255,0,255) then
pset guards,(i,j),rgb(255,0,0)
end if
next i
next j
bsave "littleGuards.bmp",guards
dim shared as any ptr tile1,tile2,tile3
tile1 = imagecreate(16,16)
tile2 = imagecreate(16,16)
tile3 = imagecreate(16,16)
for j as integer = 0 to 15
for i as integer = 0 to 15
read n
if n = 0 then pset tile1,(i,j),rgb(255,255,255)
if n = 1 then pset tile1,(i,j),rgb(0,0,255)
next i
next j
bsave "tile1.bmp",tile1
for j as integer = 0 to 15
for i as integer = 0 to 15
read n
if n = 0 then pset tile2,(i,j),rgb(100,100,100)
if n = 1 then pset tile2,(i,j),rgb(255,100,0)
next i
next j
bsave "tile2.bmp",tile2
for j as integer = 0 to 15
for i as integer = 0 to 15
read n
if n = 0 then pset tile3,(i,j),rgb(255,0,255)
if n = 1 then pset tile3,(i,j),rgb(255,200,15)
if n = 2 then pset tile3,(i,j),rgb(0,0,0)
next i
next j
bsave "tile3.bmp",tile3
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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1,1,1,1,1,1
data 1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1
data 1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
'gold
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,2,1,2,0,0,0,0,0,0
data 0,0,0,0,0,0,2,1,1,1,2,0,0,0,0,0
data 0,0,0,0,0,2,1,1,1,1,1,2,0,0,0,0
data 0,0,0,0,2,1,1,1,1,1,1,1,2,0,0,0
data 0,0,0,2,1,1,1,1,1,1,1,1,1,2,0,0
data 0,0,2,1,1,1,1,1,1,1,1,1,1,1,2,0
data 0,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2
data 0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
Code: Select all
const SCRW = 450
const SCRH = 288
screenres SCRW,SCRH,32
color rgb(0,0,0),rgb(255,255,255)
dim shared as integer SCORE
dim shared as integer tileX,tileY
dim shared as any ptr tile1,tile2,tile3
tile1 = imagecreate(16,16)
tile2 = imagecreate(16,16)
tile3 = imagecreate(16,16)
bload "tile1.bmp",tile1
bload "tile2.bmp",tile2
bload "tile3.bmp",tile3
dim shared as integer world(0 to 27,0 to 17) 'hold tile ID
const TW = 16
restore background
for j as integer = 0 to 17
for i as integer = 0 to 27
read world(i,j)
next i
next j
type SPRITE
as integer x
as integer y
as integer w 'width of sprite
as integer h 'height of sprite
as integer s 'current state eg. running, walking,climbing
as integer a 'alive or dead
as integer f 'current frame being displayed
as integer fc 'total frames in animation
as integer c 'delay between frames
as any ptr img 'image sheet
end type
dim shared as SPRITE hero
dim shared as SPRITE guard(0 to 5)
hero.x = 33
hero.y = 215
hero.w = 15
hero.h = 25
hero.a = 1
hero.fc = 4
hero.img = imagecreate(60,100)
bload "littleGuysA.bmp",hero.img
dim shared as any ptr guardImage
guardImage = imagecreate(60,100)
bload "littleGuards.bmp",guardImage
restore GuardPositions
for i as integer = 0 to 4
read guard(i).x,guard(i).y
guard(i).w = 15
guard(i).h = 25
guard(i).a = 1
guard(i).img = guardImage
next i
function testCollision(b1 as SPRITE,b2 as SPRITE) as boolean
return b2.y < b1.y+b1.h and b2.x+b2.h > b1.y and b2.x < b1.x+b1.w and b2.x+b2.w > b1.x
end function
function onTile(b as SPRITE) as integer
dim as integer ID
tileX = (b.x+b.w\2) \TW
tileY = (b.y+b.h ) \TW
return world(tileX,tileY)
end function
function inTile(b as SPRITE) as integer
dim as integer ID
tileX = (b.x+b.w\2) \TW
tileY = (b.y+b.h-1 ) \TW
return world(tileX,tileY)
end function
sub display()
hero.c = hero.c + 1
if hero.c > 10 then 'controls frame rate
hero.c = 0 'reset counter
hero.f = hero.f + 1 'next frame
if hero.f = hero.fc then
hero.f = 0
end if
end if
dim as integer v
screenlock
cls
for j as integer = 0 to 17
for i as integer = 0 to 27
v = world(i,j)
if v = 32 then
put (i*TW,j*TW),tile1,trans
end if
if v = 33 then
put (i*TW,j*TW),tile2,trans
end if
if v = 22 then
put (i*TW,j*TW),tile3,trans
end if
next i
next
'draw guards
for i as integer = 0 to 4
if guard(i).a = 1 then
put (guard(i).x,guard(i).y),guard(i).img,(guard(i).f*guard(i).w,guard(i).s*guard(i).h)-(guard(i).f*guard(i).w + guard(i).w-1,guard(i).s * guard(i).h + guard(i).h-1),trans
end if
next i
'draw hero
if hero.a = 1 then
put (hero.x,hero.y),hero.img,(hero.f*hero.w,hero.s*hero.h)-(hero.f*hero.w + hero.w-1,hero.s * hero.h + hero.h-1),trans
end if
locate 34,2
print "SCORE =";SCORE
screenunlock
end sub
do
display()
hero.s = 0 'not moving
if multikey(&H4B) then
hero.x = hero.x - 1
hero.s = 2 'move left
end if
if multikey(&H4D) then
hero.x = hero.x + 1
hero.s = 1 'move right
end if
if inTile(hero) = 32 or onTile(hero) = 32 then 'if onLadder than you can move up or down
if multikey(&H48) then 'UP
hero.y = hero.y - 1
hero.s = 3
end if
if multikey(&H50) then 'DOWN
hero.y = hero.y + 1
hero.s = 3
end if
end if
if inTile(hero)=0 then
hero.y = hero.y + 1 'gravity
end if
while inTile(hero)=33
hero.y = hero.y - 1 'pull out of ground
wend
if inTile(hero)=22 then
SCORE = SCORE + 1 'pick up gold
world(tileX,tileY)= 0 'remove gold tile
print ((hero.x+hero.w\2)\TW),((hero.y+hero.h)\TW)
sleep
end if
'adjust for left/right border
if hero.x < 0 then hero.x = 0
if hero.x > SCRW - hero.w then hero.x = SCRW - hero.w
sleep 2
loop until multikey(&H01)
background:
data 0, 0, 0, 0, 0, 0, 0, 0, 0,32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
data 0, 0, 0, 0, 0, 0, 0, 0, 0,32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
data 33,33,33, 0, 0, 0, 0, 0, 0,32, 0, 0, 0, 0, 0,33,33,33,33,32,33,33,33,33,33,33,33,33
data 0, 0,33,33, 0, 0, 0, 0, 0,32, 0, 0, 0, 0, 0,33,33, 0, 0,32, 0, 0, 0, 0, 0, 0, 0, 0
data 0, 0, 0,33,33, 0, 0, 0, 0,32, 0, 0, 0, 0,33,33, 0, 0, 0,32, 0, 0, 0, 0, 0, 0, 0, 0
data 0, 22, 0,33,33,33, 0, 0, 0,32, 0, 0, 0,33,33,33, 0, 0, 0,32, 0, 0, 0, 0, 0,22, 0, 0
data 32,33,32,33,33,33,33, 0, 0,32, 0, 0,33,33,33,33,32,33,33,32,33,33,33,33,33,33,33,33
data 32, 0,32, 0, 0, 0,33,33, 0,32, 0,33,33, 0, 0, 0,32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
data 32, 0,32, 0, 0, 0, 0,33,33,32,33,33,33, 0, 0, 0,32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
data 32,33,33,33,32, 0, 0, 0, 0,32, 0, 0, 0, 0, 0,33,32,33,33,32,33,33, 0, 0, 0, 0, 0, 0
data 32, 0, 0, 0,32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,32, 0, 0, 0, 0, 0, 0, 0, 0
data 32, 0, 0, 0,32, 0, 0, 0,22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,32, 0, 0, 0, 0, 0, 0, 0, 0
data 32, 0, 0, 0,32,33,33,33,33,33,33,33,32,33,33,33,33,33,33,32,33,33,33,33,33,32,33,33
data 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,32, 0, 0
data 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,32, 0, 0, 0, 0, 0, 0,22, 0, 0, 0, 0, 0,32, 0, 0
data 33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33
data 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
data 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
GuardPositions:
data 18,7, 355,7, 355,71, 99,167, 353,167