Take a look at these two function.
What am I doing wrong?
here is all the code
Function place() If MouseDown(KEY_MOUSELEFT) For Local i:Int = 0 To mapx-1 For Local j:Int = 0 To mapy-1 map[i,j] = curtile Next Next EndIf End Function Function update() For Local x:Int = 0 To mapx-1 For Local y:Int = 0 To mapy-1 DrawImage tiles,x*50,y*50,map[mapx-1,mapy-1] Next Next End Function
What am I doing wrong?
here is all the code
Strict Rem MapEditor Version 0.1 Author : Amon Compiler : BlitzMax EndRem Incbin "backblock.png" Incbin "icon.png" Graphics 800,600,16,0 SetMaskColor 0,0,0 Global tiles:TImage = LoadAnimImage("incbin::backblock.png",50,50,0,9,MASKEDIMAGE) Global icon:TImage = LoadImage("incbin::icon.png",MASKEDIMAGE) Global tileframe:Int = 0 Global mapx:Int = 16 Global mapy:Int = 12 Global curtile:Int = 0 Global map:Int[mapx,mapy] Repeat Cls nexttile() place() update() drawcurser() Flip Until KeyHit(KEY_ESCAPE) Function drawcurser() Local xpos:Int = MouseX()/50*50 Local ypos:Int = MouseY()/50*50 DrawImage tiles,xpos,ypos,curtile End Function Function nexttile() If MouseHit(KEY_MOUSERIGHT) curtile:+1 If curtile > 8 Then curtile = 0 EndIf End Function Function place() If MouseDown(KEY_MOUSELEFT) For Local i:Int = 0 To mapx-1 For Local j:Int = 0 To mapy-1 map[i,j] = curtile Next Next EndIf End Function Function update() For Local x:Int = 0 To mapx-1 For Local y:Int = 0 To mapy-1 DrawImage tiles,x*50,y*50,map[mapx-1,mapy-1] Next Next End Function