Jump Up, Pico Star!
A tribute/demake of the jump-rope mini-game from Super Mario Odyssey, made for Tweet Tweet Jam 3.
Press Z to jump.
PICO-8 source code:
h=0 d=1s=0.2j=0t=0p=0l=line w=rectfill poke(0x5f2c,3)function _update60() h+=d*s if (h>12)d=-1 if (h<0)then d=1if j==0 then p=0s=.2 else p+=1s+=.01 if (t<p)then t=p end end end if j==0then if (btnp(🅾️))j=5 end j=max(j-.2,0)cls()w(0,13,63,50,3)w(0,13,63,41,12) ?"웃",4,37,13 ?"웃",52,37,13 if (d>=1)r(h,6) x(j) if (d<1) r(h,7) print(p,13,16,10)print(t,46,16,10)end function r(z,y)l(10,41-z,52,41-z,y)end function x(z) ?"웃",28,37-z,1 ?"😐",28,33-z,15 l(29,33-z,33,33-z,8)l(27,32-z,35,32-z,8)l(27,31-z,35,31-z,8)l(28,30-z,34,30-z,8)w(29,35-z,33,36-z,5) end
And the same code again in expanded, commented explain-o-vision.
--declaring our variables h=0 // the Height of the rope d=1 // the rope's current Direction (1 or -1) s=0.2 // the rope's Speed j=0 // the player's Jump height - 0 means they're on the ground t=0 // the Top score p=0 // the Player's current score --aliasing some function names to save space later on l=line w=rectfill --switching to lo-res mode poke(0x5f2c,3) --our main loop! function _update60() --first we move the rope - by multiplying the rope speed (s) by --the current rope direction (d) and adding it to the current height (h) h+=d*s --if the rope's height (h) is more than 12 then it's the top of its travel --so we set its direction (d) to -1 (i.e. travelling down) if (h>12) d=-1 --if the rope's height (h) is less than 0 then it's at its low point --so we set its direction (d) to 1 (i.e. travelling up) if (h<0)then d=1 --additionally, if the player is standing on the ground when the rope --is at its low point, then the player has hit the rope and the -- game is over.. if j==0 then --...so we reset the player (p) score to zero, --and we set the rope speed (s) back to its original .2 p=0s=.2 else --but if the player is jumping when the rope is at its low point, --we add one to their score (p) and increase the rope speed (s) by .01 p+=1s+=.01 --and if the top score (t) is now lower than the player's score (p) --then we update the high score if (t<p)then t=p end end end --PLAYER INPUT --if the player is currently on the ground (j=0), we check if the player --pressed the button; if they did, we set their jump height to 5 (j=5+) if j==0 then if (btnp(�������)) j=5 end --and if the player is currently jumping, we decrease their jump height (j) --by .2 each frame until they are back on the ground j=max(j-.2,0) --DRAWING THE GRAPHICS --(usually done separately in the _draw() function, --but for TweetTweetJam we put it in _update60() to save space) --clear the screen cls() --draw two rectangles to represent the sky/grass w(0,13,63,50,3) w(0,13,63,41,12) --draw the two people holding the rope ?"웃",4,37,13 ?"웃",52,37,13 --if the rope is travelling up, draw it in gray behind the player if (d>=1) r(h,6) --draw the player x(j) --if the rope is travelling down, draw it in white in front of the player if (d<1) r(h,7) -- and finally, print the scores at the top print(p,13,16,10) print(t,46,16,10) --and that's it! end --OR IS IT? --a couple of extra functions written to save space --the 'r' function draws the rope with a given height (z) and color (y) function r(z,y) l(10,41-z,52,41-z,y) end --the 'x' function draws the player at height (z) function x(z) --first draw the body in dark blue ?"웃",28,37-z,1 --then draw the head in a caucasian skin colour ?"😐",28,33-z,15 --then draw four red lines to form the shape of a hat l(29,33-z,33,33-z,8) l(27,32-z,35,32-z,8) l(27,31-z,35,31-z,8) l(28,30-z,34,30-z,8) --and finally, draw a single brown line to make a mustache w(29,35-z,33,36-z,5) end
Status | Released |
Platforms | HTML5 |
Rating | Rated 4.0 out of 5 stars (2 total ratings) |
Author | Harder You Fools |
Genre | Sports |
Made with | PICO-8 |
Tags | PICO-8, tweet, tweet-tweet-jam |