0 Members and 3 Guests are viewing this topic.
Yes that should more than fine EDIT - Also i added support for xLIB BG PIC's which are small res 80x60, 256 colour images that are scaled to fullscreen. These only take up 4800 bytes and could possibly be used for simple backgrounds, titlescreens or RPG battle backgrounds etc.Here is a demo of a few strung together:.
Yeah pretty much, plus i hope i have coded things a little better this time around anyway .I have also added a 'replaceTile' function which will search a tilemap string and replace the specified tileID with another. Can be useful for easy 2-frame tile animations.
:real(0,1,0:"TESTTILE:real(5,0,0:real(1,1,0,80:real(1,1,1,8:real(1,1,2,8:real(1,1,3,8:real(1,1,4,0:real(1,1,5,0:real(1,1,6,40:real(3,0,4,5,6,9,0,0,19,14,1:real(3,3,9,2,62,63,60,61:real(3,0,4,5,6,9,0,0,19,14,0:real(3,3,9,2,63,62,61,60:Repeat real(2,0)=15:If real(1,0,4)≠real(3,4,real(1,0,0),20) or real(1,0,5)≠real(3,4,real(1,0,1),15):Then:real(1,1,4,real(3,4,real(1,0,0),20:real(1,1,5,real(3,4,real(1,0,1),15:real(3,0,4,5,6,9,0,0,19,14,1:real(3,3,9,2,62,63,60,61:real(3,0,4,5,6,9,0,0,19,14,1:real(3,3,9,2,63,62,61,60:End:real(4,0,0,1,1,1,‾8real(1,0,4),‾8real(1,0,5),248,1,0,125:real(4,0,2,3,1,1,‾8real(1,0,4),‾8real(1,0,5),1,0,0,real(3,1,2,3,6,9,0,0:real(1,1,2,real(1,0,0:real(1,1,3,real(1,0,1:real(2,4,0,1,8,8,6,19,9,0,0,7,7:End:real(0,1,1
"Enable 160x240 mode:real(0,1,0"Load appvar tilePIC called "TESTTILE into memory slot 0:"TESTTILE:real(5,0,0"Create player X,Y and tempX,tempY user variables:real(1,1,0,80:real(1,1,1,8:real(1,1,2,8:real(1,1,3,8"Create map X,Y,MAPWIDTH user variables:real(1,1,4,0:real(1,1,5,0:real(1,1,6,40"Draw tilemap (uservar 4,5,6) to current GRAM buffer and switch GRAM (updateLCD):real(3,0,4,5,6,9,0,0,19,14,1"Replace flower animated tiles in tilemap with 2nd frames:real(3,3,9,2,62,63,60,61"Draw tilemap (uservar 4,5,6) to current GRAM buffer (since we switched):real(3,0,4,5,6,9,0,0,19,14,0"Replace flower animate tiles to original frames:real(3,3,9,2,63,62,61,60"Main loop (until player presses CLEAR:Repeat real(2,0)=15"Check if player X or Y is a different screen multiple than the current map X/Y (walked to a different area):If real(1,0,4)≠real(3,4,real(1,0,0),20) or real(1,0,5)≠real(3,4,real(1,0,1),15):Then"If so then store new map X/Y and redraw map, replacing animated tiles as before:real(1,1,4,real(3,4,real(1,0,0),20:real(1,1,5,real(3,4,real(1,0,1),15:real(3,0,4,5,6,9,0,0,19,14,1:real(3,3,9,2,62,63,60,61:real(3,0,4,5,6,9,0,0,19,14,1:real(3,3,9,2,63,62,61,60:End"Draw main player sprite at player X/Y (uservar 0,1) and switch GRAM (updateLCD):real(4,0,0,1,1,1,‾8real(1,0,4),‾8real(1,0,5),248,1,0,125"Redraw the tile at temp X/Y (uservar 2,3) that the previous player sprite was over to restore the tilemap:real(4,0,2,3,1,1,‾8real(1,0,4),‾8real(1,0,5),1,0,0,real(3,1,2,3,6,9,0,0"Copy current player X/Y to temp X/Y for use in next frame:real(1,1,2,real(1,0,0:real(1,1,3,real(1,0,1"Get keypresses and move 8 pixels in X/Y, check that there are no collisions with any tiles >19 in the tilemap:real(2,4,0,1,8,8,6,19,9,0,0,7,7"Loop:End"Restore LCD to 320x240 mode:real(0,1,1