No, already tried the both. I didn't clean up the code, but here it is anyway:-
Code: Select all
If InitKeyboard() = 0 Or InitSprite() = 0
MessageRequester("Error", "DirectX 7 unloadable", 0)
End
EndIf
InitMouse()
XIncludeFile "project b map.pb"
Dim ground(58,40)
Dim move(58,40)
Dim drawnextscreen(30,20)
Dim movenextscreen(30,20)
OpenWindow(0,300,300,640,480, #PB_Window_ScreenCentered | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget, "Something")
OpenWindowedScreen(WindowID(),10,10,600, 480, 1,10,10)
posx = 100
posy = 100
objx = -100
objy = -100
speed=1
right=2
left=10
up=18
down=26
For l=1 To 33
LoadSprite(l,"data/sprites/"+Str(l)+".bmp")
Next
For t= 1 To 33
TransparentSpriteColor(t,255,255,255)
Next
LoadSprite(38,"groundL.bmp",0)
LoadSprite(39,"groundR.bmp",0)
LoadSprite(40,"groundU.bmp",0)
LoadSprite(41,"groundD.bmp",0)
LoadSprite(42,"groundUL.bmp",0)
LoadSprite(43,"groundUR.bmp",0)
LoadSprite(44,"groundDL.bmp",0)
LoadSprite(45,"groundDR.bmp",0)
LoadSprite(35,"ground2.bmp",0)
LoadSprite(37,"grass.bmp",0)
For t=1 To 9
LoadSprite(t+47,"mudgrass"+Str(t)+".bmp",0)
Next t
For t=1 To 4
LoadSprite(56+t,"tree"+Str(t)+".bmp",0)
TransparentSpriteColor(56+t,255,0,255)
Next t
LoadSprite(61,"data/box.bmp",0)
TransparentSpriteColor(61,255,0,255)
LoadSprite(46,"data/house1.bmp",0)
LoadSprite(47,"data/house2.bmp",0)
beginning:
a=1
Restore level1
For y=1 To 40
For x=1 To 58
Read ground(x,y)
Next
Next
For ay=1 To 40
For ax=1 To 58
Read move(ax,ay)
Next
Next
For y=1 To 20
For x=1 To 30
Read drawnextscreen(x,y)
Next
Next
For ay=1 To 20
For ax=1 To 30
Read movenextscreen(ax,ay)
Next
Next
SetFrameRate(60)
SetRefreshRate(60)
ReleaseMouse(1)
Repeat
WindowEvent()
Delay(1)
ExamineScreenModes()
ExamineKeyboard()
If KeyboardPushed(#PB_Key_Left):move=1
ElseIf KeyboardPushed(#PB_Key_Right):move=2
ElseIf KeyboardPushed(#PB_Key_Up):move=3
ElseIf KeyboardPushed(#PB_Key_Down):move=4
ElseIf KeyboardPushed(#PB_Key_D):move=5
EndIf
If KeyboardPushed(#PB_Key_Leftshift) Or KeyboardPushed(#PB_Key_RightShift):speed=2:Else:speed=1:EndIf
If KeyboardReleased(#PB_Key_Escape) : Quit=1 : EndIf
Select move
Case 0
a=1
Case 1
If check<>1 And check<>6 And check<>7
xco-8
If posx<180
objx=objx+8*speed
Else
posx-8*speed
EndIf
EndIf
left=left+1
Delay(100/speed)
If left>17 : left=10 : EndIf
a=left
move=0
Case 2
If check<>2 And check<>5 And check<>8 And check<>10
xco+8
If posx>300
objx=objx-8*speed
Else
posx+8*speed
EndIf
Else
EndIf
If check=10
Goto nextscreen
EndIf
right=right+1
Delay(100/speed)
If right>9 : right=2 : EndIf
a=right
move=0
Case 3
If check<>3 And check<>7 And check<>8 And check<>9
yco-8
If posy<180
objy=objy+10*speed
Else
posy-10*speed
EndIf
Else
If check=9
a=up
Delay(20)
move=0
Goto inhouse
EndIf
EndIf
up=up+1
Delay(100/speed)
If up>33 : up=26 : EndIf
a=up
move=0
Case 4
If check<>4 And check<>5 And check<>6
yco+8
If posy>340
objy=objy-10*speed
Else
posy+10*speed
EndIf
EndIf
down=down+1
Delay(100/speed)
If down>25 : down=18 : EndIf
a=down
move=0
Case 5
If SpritePixelCollision(a,posx,posy,61,700+objx,300+objy)
collected=1
EndIf
EndSelect
ClearScreen(0,0,0)
For y=1 To 39
For x=1 To 58
bl=ground(x,y)
DisplayTransparentSprite(bl,x*30+objx,y*30+objy)
Next
Next
ax.l=(posx-objx)/30
ay.l=(posy-objy)/30
check.l=move(ax,ay)
DisplayTransparentSprite(a, posx, posy)
If collected=0
DisplayTransparentSprite(61,700+objx,300+objy)
EndIf
For x=1 To 58
y=40
bl=ground(x,y)
DisplaySprite(bl,x*30+objx,40*30+objy)
Next
StartDrawing(ScreenOutput())
Locate(200,200)
DrawText(text$)
Locate(10,10)
DrawingMode(1)
FrontColor(255,255,255)
DrawText("X Co-ordinate: "+Str(xco)+" Y Co-ordinate: "+Str(yco))
StopDrawing()
EventID.l=WaitWindowEvent()
FlipBuffers()
Until EventID=#PB_Event_CloseWindow Or Quit=1
If it's something blatant, please just tell me. The map file ain't important, it just has the datasection bit.
Thanks in advance.