Just a little test to draw a set of tesselating sprites in the sprite sheet and then randomly generate a constantly changing landscape.

I've been working on a tile based puzzle game recently and to make things easy initially I setup random generating levels. While this helped me get through adding and testing the mechanics and my code I realised that some times in testing I'd get a level I might want to play again but as it was one of eight million I wasn't likely to generate it again.

So I realised that I would need to create Level IDs and a system for inputting them. This is my first attempt at a very basic input and the screen displays the output too that I would feed into some variables in my game to get back to that challenging level.

As a complete novice any feedback or improvements are greatly appreciated. My known bugs so far are not knowing a slick method to stop the highlight moving off either end of the row and not being able to limit the range of letters (you can go down from A etc.)

--basic levelid i/o --by lorcav function _init() cls() hlight={} hlight.x=32 hlspr=29 l1=1 l2=1 l3=1 l4=1 l5=1 l6=1 l7=1 actsprpos=1 end function _update() cls() map (0,0,0,0,16,8) move(hlight) spr(hlspr,hlight.x,40) spr(30,hlight.x,24) spr(l1,32,32) spr(l2,40,32) spr(l3,48,32) spr(l4,56,32) spr(l5,64,32) spr(l6,72,32) spr(l7,80,32) movebound() end function move() if(btnp(0)) --left then hlight.x-=8 actsprpos-=1 end if(btnp(1))--right then hlight.x+=8 actsprpos+=1 end if(btnp(2))--up then entryup() end if(btnp(3))--down then entrydown() end if(btnp(4))--confirm then end end function entryup() if actsprpos==1 then l1+=1 end if actsprpos==2 then l2+=1 end if actsprpos==3 then l3+=1 end if actsprpos==4 then l4+=1 end if actsprpos==5 then l5+=1 end if actsprpos==6 then l6+=1 end if actsprpos==7 then l7+=1 end end function entrydown() if actsprpos==1 then l1-=1 end if actsprpos==2 then l2-=1 end if actsprpos==3 then l3-=1 end if actsprpos==4 then l4-=1 end if actsprpos==5 then l5-=1 end if actsprpos==6 then l6-=1 end if actsprpos==7 then l7-=1 end end function movebound() if hlight.x>=81 then hlight.x=32 actsprpos=1 end if hlight.x<=31 then hlight.x=80 actsprpos=7 end if l1>=14 then l1=1 end end function _draw() print ("please enter level id",19,44,10) print (l1,35,52,8) print (l2,43,52,8) print (l3,51,52,8) print (l4,59,52,8) print (l5,67,52,8) print (l6,75,52,8) print (l7,83,52,8) end |

I'm working up the basics for a small tile puzzle game where players navigate through a maze filling the path behind them so that they can only move on each tile once. so a trail that will then have some collision so it can't be crossed

I'm having trouble working out how to leave a trail of sprites. I have a grid set up, and a player sprite to move as follows:

function _init() x = 0 y = 64 end function _update() if (btnp(0)) then x=x-8 end if (btnp(1)) then x=x+8 end if (btnp(2)) then y=y-8 end if (btnp(3)) then y=y+8 end end function _draw() rectfill(0,0,127,127,7) spr(1,x,y) end |

I've tried having something in draw but this ended with the designated sprite following the player around and I tried adding something in the update function with the keystrokes but this b0rked it.

It seems to be something beyond what I kno so even if someone can point me in the right direction of something to read up on or code to review that would be much appreciated.