Log In  


So, election and holiday season both got pretty crazy up until last week. So most of my PICO-dev has been during lunch breaks and to/from work or in little spurts on days off. That said... I probably get about 16-32 sprites, or 4-8 screens of map writing done, maybe a function per toss. That said, a fair number of these can reuse some code I use, which is a good thing; because I can concentrate most of my code into one project, iterate it to working condition, then copypaste and adapt it to other carts. All things considered, I still wish I could've been getting more accomplished by now; maybe it's just impatience talking... I see a fair number of good carts being pushed, maybe that's the thing.

These include Concert of the Damned (really, I've only reworked the maps so far), 200x (pictured above... if 20xx was the proc-gen response to MegaMan X, this is me trying to do that with MegaMan Classic or Xtreme, if it were meshed with MM9's Endless Attack mode), Gentroid (same approach but more Classic Metroid inspired), a simply-titled "PlayThing" (just an experiment for learning various things in PICO-8; where I'm currently focusing my code for the time being), "Race to Riches" (a simple speed platformer inspired by David Newton's "Treasure Tower"), and "Shirley Nutt" (a nut-collecting demake of Sonic, but where you can shoot nuts forward to control space ahead of you, and with none of the asinine plot or buddies or loop-de-loops, or even bosses).

Matter of fact, I have two experimental "Playthings." XD I started one on my PC, and a second, different-but-similar sort of one on my PocketCHIP. There's some ground they have in common but I have to kind of match up the factors and really make one do something.

That's one "plaything's" spritesheet so far and here's the other:

The first is geared with more versatility in mind where the second is clearly more action-platformer based. I'm learning to toy with compound sprites in both cases, but in the first I'm trying to layer elements together to make more expressions, where with the second I'm playing with making more distinct "characters." Either way, I do feel like it's more prudent to utilize the map space to it's max more than the sprite space; but I do feel tugged between the two approaches.



I think I've gotten most of my movement code together. I still feel like, player-object nonwithstanding, I'm forgetting something... >.>

PS: It's not the globals, either. I have those stored seperately.

function shuf(t)
 local r=rnd
 assert (t,"shuf() expects table, got nil")
 local iterations=#t
 local j
 for i=iterations,2,-1 do
  j=rnd(i)
  t(i),t(j)=t(j),t(i)
 end
end

function p_run()
 local aframes=accframes
 local xmove=maxrun
 if (btnp(0)) facing=-1
 if (btnp(1)) facing=1
 if (btn(0)=1 and btn(1)=1)
 then (btn(0),btn(1))=(0,0)
 else
 if btn(0)=1 or btn(1)
 aframes-=1
 else
 if btn(0)=0 and btn(1)=0
 foreach aframes<accframes
 aframes+=2
 end
 for a=1,aframes
  xmove*=fricrate
 end
 if (xmove>maxrun) xmove=maxrun
 player.x+=xmove*facing
end

function p_jump(jh or 0, jf or 0)
 if (jh=0) jh=jumpheight
 if (jf=0) jf=jumpframes
 local px=jh/(jf!)
 for j=-jf,999
  ymove=px*j
  if(ymove>maxdrop)ymove=maxdrop
  j+=1
  if(j>999)j=999
end

function hitwall(_x,_y)
 if (checkspot(p.x,p.y,0)or checkspot(p.x,p.y+7,0) return true
 if (checkspot(p.x+7,p.y,0)or checkspot(p.x+7,p.y+7,0) return true
 return false
end

function hitfloor(_x,_y)
 if (checkspot(p.x,p.y,0)or checkspot(p.x+7,p.y,0)) return true
 if (checkspot(p.x,p.y+7,0)or checkspot(p.x+7,p.y+7,0)) return true
 return false
end

function checkspot(_x,_y,_flag)
 local tilex=flr(_x/8)
 local tiley=flr(_y/8)
 local tile=mget(tilex+levelx,tiley+levely)
 return fget(tile,_flag)
end

function bounce(obj,m,xdir or -1,ydir or -1)
 obj.xmove=m*xdir*2
 obj.ymove=m*ydir
 if hitwall(obj.x,obj.y)=true
 then
 xdir*=-1
 obj.xmove=m*xdir*2
 obj.ymove=m*ydir
 else
 if hitfloor(obj.x,obj.y)=true
 then
 ydir*=-1
 obj.xmove=m*xdir
 obj.ymove=m*ydir*2
end

function movep()
 local oldx=p.x
 local oldy=p.y
 (p.x,p.y)+=(xmove,ymove)
 if (hitwall(p.x,p.y)=true) p.x=oldx
 if (hitfloor(p.x,p.y)=true) p.y=oldy
end

function maketarget(obj,scr,x,y,xrange or 0,yrange or 0,speed or 0,loop or 0)
--x/y position relative to map
 obj.p.x=((scr\5)*16+x)
 obj.p.y=((scr/5)*16+y)
--set sine motions to control
 local movex=2*sqrt(xrange)*speed
 local movey=2*sqrt(yrange)*speed
--reverse direction! 
 if (movex=xrange or movex=-xrange or xrange<0) movex*=-1
 if (movey=yrange or movey=-yrange or yrange<0) movey*=-1
--diagonals or curves
 if loop=1 then
  movex=xrange
 elseif loop=-1 then
  movex-=xrange
end

function collide(obj, other)
	if
	other.p.x+other.hitbox.x+other.hitbox.w > obj.p.x+obj.hitbox.x and 
	other.p.y+other.hitbox.y+other.hitbox.h > obj.p.y+obj.hitbox.y and
	other.p.x+other.hitbox.x < obj.p.x+obj.hitbox.x+obj.hitbox.w and
	other.p.y+other.hitbox.y < obj.p.y+obj.hitbox.y+obj.hitbox.h 
	then
	return true
	end
end

PPS: I'm noticing I'm doing that bad, old C++/C# FOR looping, forgetting the add parameter! Oh, the joys of writing about three functions a week... :/



[Please log in to post a comment]