Code: Alles auswählen
IncludeFile "engine.pb"
If InitSprite() = 0 : MessageRequester("","Sprites could not be initialised. DirectX 7 or higher is needed!") : EndIf
If InitKeyboard() = 0 : MessageRequester("","Keyboard could not be initialised. DirectX 7 or higher is needed!") : EndIf
If InitMouse() = 0 : MessageRequester("","Mouse could not be initialised. DirectX 7 or higher is needed!") : EndIf
UseJPEGImageDecoder() : UsePNGImageDecoder() : UsePNGImageEncoder()
kameraX.l = PlayerSpeed
kameraY.l = PlayerSpeed
Procedure.l FPS()
Shared Zeit, Frames, Ausgabe
If ElapsedMilliseconds() < Zeit + 1000
Frames + 1
Else
Ausgabe = Frames
Frames = 0
Zeit = ElapsedMilliseconds()
EndIf
If Ausgabe > 0
ProcedureReturn Ausgabe
Else
ProcedureReturn 60
EndIf
EndProcedure
Enumeration
;window
#window_1
#window_2
; Sprites
#Sprite_Interface
#Sprite_cursor
; warrior01
EndEnumeration
; SystemVariablen
msPerFrame.l = 80
ActTimer = ElapsedMilliseconds() + msPerFrame
Posi.l = 1 ; Variable, es wird abgefragt ob sich der Spieler
; im Interface, oder im eigentlichen game ist.
; 1 = Interface 2 = Game
windowed.l
OpenConsole()
PrintN("Windowed(w) or fullscreen(f)?")
antwort.s = Input() : If antwort = "w" : windowed = #True : EndIf : If antwort = "f" : windowed = #False : EndIf
CloseConsole()
If windowed = #True
OpenWindow(#window_1,0,0,640,480,#PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_BorderLess | #PB_Window_ScreenCentered, "Mage of Fear")
OpenWindowedScreen(WindowID(),0,0,640,480,0,0,0)
UseWindow(#window_1)
EndIf
If windowed = #False
OpenScreen(640,480,16,"Mages And Warriors")
EndIf
CatchSprite(#Sprite_Interface, ?Introface)
CatchSprite(#Sprite_cursor, ?cursor)
TransparentSpriteColor(#Sprite_cursor,255,0,255)
For n=4 To 18
LoadSprite(n, "GFX\Tiles\"+Str(n)+".PNG")
Next
LoadTileMap()
; Main
MouseLocate(240,180)
Repeat
ExamineKeyboard()
If Posi = 1
ExamineMouse()
MausX = MouseX()
MausY = MouseY()
DisplaySprite(#Sprite_Interface,60,20)
DisplayTransparentSprite(#Sprite_cursor,MausX,MausY)
If KeyboardPushed(#PB_Key_S)
Posi = 2
EndIf
EndIf
If Posi = 2
showmap(0,0)
FPS()
If windowed = #True : StartDrawing(WindowOutput()) : EndIf
If windowed = #False : StartDrawing(ScreenOutput()) : EndIf
EndIf
Repeat: Delay(1) : Until ElapsedMilliseconds() > ActTimer
ActTimer + msPerFrame
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)
End
DataSection
cursor: IncludeBinary "GFX\cursor.png"
;face
Introface: IncludeBinary "GFX\Interface.jpg"
EndDataSection
Code: Alles auswählen
For n=4 To 18
LoadSprite(n, "GFX\Tiles\"+Str(n)+".PNG")
Next
LoadTileMap()
das Programm liest dann die Longs aus (wo momentan eine 5, und noch eine 5 stehen) und will dann 25 weitere Longs (wo momentan die Zahl 6 drin ist)
Also müsste er doch theoretisch das Bild 6.PNG 25x anzeigen...
Sorry, dass ich so schwer von Begriff bin