Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- OPTION BASE 0
- windowDisplay& = _NEWIMAGE(800, 600, 32) 'Set up the window screen
- SCREEN windowDisplay& 'Apply the window screen
- _TITLE "Platformer" 'Set the window title
- DIM stp% 'Global timer
- DIM level%(64, 64) 'Tile IDs within the level
- DIM tiles&(128) 'Tile graphics
- DIM scrollX% 'Camera X position
- DIM scrollY% 'Camera Y position
- DIM tempFile$ 'Used for the tile loading routine
- DIM index% 'Used for the tile loading routine
- index% = -1 'This is set to -1 because the routine changes it to 0 when it begins
- CHDIR "Platformer/Tiles"
- RESTORE tilePaths
- DO 'Load all of the tile graphics
- READ tempFile$
- IF tempFile$ <> "0" THEN
- index% = index% + 1
- tiles&(index%) = _LOADIMAGE(tempFile$)
- ELSE
- GOTO Done
- END IF
- LOOP
- Done:
- CHDIR "../BGM"
- bgMusic& = _SNDOPEN("NormalTheme.wav") 'Load a music file into the long variable called "bgMusic&"
- RESTORE LevelData
- FOR i = 0 TO 7
- READ level%(0, i), level%(1, i), level%(2, i), level%(3, i), level%(4, i), level%(5, i), level%(6, i), level%(7, i)
- NEXT
- _SNDLOOP bgMusic& 'Loop the music
- WHILE 1 'Main game loop
- CLS
- stp% = stp% + 1
- scrollX% = 80 * SIN(25 * stp% / 2)
- scrollY% = 80 * COS(25 * stp% / 2)
- FOR x% = 0 TO 63
- FOR y% = 0 TO 63
- _PUTIMAGE ((x% * 32) + scrollX%, (y% * 32) + scrollY%)-(((x% * 32) + scrollX%) + 31, ((y% * 32) + scrollY%) + 31), tiles&(level%(x%, y%))
- NEXT
- NEXT
- PRINT "TIME: "; MID$(TIME$, 7, 2)
- _DISPLAY 'Update the graphics
- _LIMIT 60 'Limit to 60 FPS
- WEND
- tilePaths: 'The paths for the tile graphics
- DATA "air.png"
- DATA "Grass/grassFloorLeftLedge.png"
- DATA "Grass/grassFloor.png"
- DATA "Grass/grassFloorRightLedge.png"
- DATA "Grass/grassLeftLedge.png"
- DATA "Grass/grassInside.png"
- DATA "Grass/grassRightLedge.png"
- DATA "Grass/grassCeilLeftLedge.png"
- DATA "Grass/grassCeil.png"
- DATA "Grass/grassCeilRightLedge.png"
- DATA "Grass/grassCornerTL.png"
- DATA "Grass/grassCornerTR.png"
- DATA "Grass/grassCornerBL.png"
- DATA "Grass/grassCornerBR.png"
- DATA "Grass/grassRampUpLeft.png"
- DATA "0"
- LevelData: 'Test level data
- DATA 0,0,0,0,0,0,0,0
- DATA 0,0,0,0,0,0,0,14
- DATA 0,0,0,0,0,0,14,10
- DATA 0,0,0,1,2,2,10,0
- DATA 0,0,0,4,0,0,0,0
- DATA 0,0,0,4,0,0,0,0
- DATA 0,0,0,4,0,0,0,0
- DATA 2,2,2,10,0,0,0,0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement