Thanks, "puki" ... whaddya watchin'?
Well, here comes Number
8) "TileImage" isn't what you want, IsaacJS2. It's "DrawImage".
This should do nicely:
Well, here comes Number
8) "TileImage" isn't what you want, IsaacJS2. It's "DrawImage".
This should do nicely:
;Draw map image and test world creation algorithm for tweaking Global x=0 Global y=0 Global Grassmap Global Oceanmap Global Forestmap Global Desertmap Global Icemap SeedRnd MilliSecs() Global game = True While game StartWorld ; initialize game = PlayGame() ; show the tiles Wend End ; **************************** Function StartWorld() Graphics 800,600 ;Set video mode x=0 ;Reset coordinates to 0 y=0 SetBuffer BackBuffer() ;Draw these images to the backbuffer Grassmap=LoadImage("Grass 1.png") ;Load Images... Oceanmap=LoadImage("Ocean 2.png") Forestmap=LoadImage("Forest 1.png") Desertmap=LoadImage("Desert Sand 1.png") Icemap=LoadImage("Ice 1b.png") End Function Function PlayGame%() While y < 576 Select Rand(0,4) Case 0 ;If Grass chosen, set DrawMapImage accordingly DrawMapImage=Grassmap ;and go to function to draw this image to ;Repeat as needed... Case 1 DrawMapImage=Oceanmap Case 2 DrawMapImage=Forestmap Case 3 DrawMapImage=Desertmap Case 4 DrawMapImage=Icemap End Select DrawImage DrawMapImage,x,y x=x+64 If x >= 768 Then y=y+64 x=0 EndIf Wend Text 20, 20, "Hit Enter for new terrain. Any other key returns to desktop." VWait Flip ; Put backbuffer image onto front screen and show image key = WaitKey() If KeyHit(28) Cls FreeImage Grassmap ;Free the following images from memory... FreeImage Oceanmap ;Repeat as needed... FreeImage Forestmap FreeImage Desertmap FreeImage Icemap Return True ; start over again. this is ugly code und should be changed Else Return False EndIf End Function