Log In  

Cart #nin_pico_beat-2 | 2021-03-27 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
13

PIC-o-BEAT

PIC-o-BEAT is a rhythm game that really paints a picture

How to play?

1-Pick a beat

Choose a song from the 8 options with different style and speed to set your difficulty

2-Pick a pic

Choose a picture from the 48 available, they come in 3 sets: 8x8,harder 8x8 and 16x16

3-Paint!

Hit the notes as they get to the pointers, you can set your controls on the main menu:

Control scheme 0:

  • Directional - Yellow
  • Z and X - Blue

Control scheme 0:

  • Z,Down,Right - Yellow
  • X,Up,Left - Blue

4- Medals

If you get 100% you get a medal depending on your difficulty
[0x0]

How it works?


--bad code ahead--
this is how the images are stored
[0x0]

first the score then the texture right under
the program first scans the top image to a buffer from a pointer to some pixels ahead

  for i=0,17 do
   local posx, posy = ((point+i-2)%imgs)+imgp.x,imgp.y+flr((point+i-2)/imgs)
   if i==17 then
    if sget(posx, posy) == 10 then --is  yellow
      scrbuf[i] = 1
    elseif sget(posx, posy) == 12 then --is  blue
      scrbuf[i] = 2
    else
      scrbuf[i] = 0
    end
   else
     scrbuf[i] = scrbuf[i+1]
   end
  end

we also update the pointer every 2 beats of the first sfx channel using stat(), this way the speed of the pointer follows the speed of the song (this method could be used to follow odd time signatures/rhytms by using %3 for example)

  c2 = c1
  c1 = stat(20)
  if c1 != c2 then
    if c1%2 == 0 then
      point+=1
      readspr()
    else
      return false
    end
  end

if we press a key we check the buffer at the right spot to check if you got the note right
if so, we paint a dedicated piece of the spritesheet with the right texture and set the buffer with a "empty" note
if you press a wrong note, we also paint it with the texture but with offset colors, and put a "wrong" note on the buffer
if you press on empty you paint the texture and set a "not empty" note

 if inpa then
   if scrbuf[2] == 2 then
     sset(imgx,imgy,sget(posx,posy+imgs))
     scrbuf[2] = 10
   elseif scrbuf[2] == 1 or scrbuf[2] == -1 then
     sset(imgx,imgy,(((sget(posx,posy+imgs)+1)%15)+1))
     scrbuf[2] = -1
   elseif scrbuf[2] == 0 then
     sset(imgx,imgy,sget(posx,posy+imgs))
     scrbuf[2] = -3
   end
 elseif(...)

Once the song ends we just check the score textures and keep count of the errors
if black, is the end texture black?
if B or Y, is the end texture and img texture the same color?

for i=0,imgs*imgs do
    local imgx, imgy = ((i)%imgs)+112,flr((i)/imgs)
    local posx, posy = ((i)%imgs)+imgp.x,imgp.y+flr((i)/imgs)
    if sget(posx, posy) == 0 then
      if sget(imgx,imgy) != 0 then
        errors +=1
      end
    else
     if oneb == false then
      if sget(imgx,imgy) != sget(posx,posy+imgs) then
        errors +=1
      end
     else
       if sget(imgx,imgy) != sget(posx,posy) then
        errors +=1
       end
     end
    end
  end

and to do the medals you just peek and poke at the designated hex

and that's basically the whole mechanic, to create "expasion packs" it's just a matter of drawing over the textures, or creating new music but i've drawn too much already lol

changelog


V1.2: bugfixes and optimizations

  • removed "ghost notes" when replaying a pic
  • removed bug where perfect would stop registering if you "End Run" then exit
  • overall code optimization of 222 tokens

V1.3 even more optimizations

  • fixed bug where it wouldn't save more than one medal per session
  • more code optimization of 213 tokens

P#89423 2021-03-24 04:05 ( Edited 2021-03-27 16:20)

1

Very cool! That cherry level was lots of fun

P#89427 2021-03-24 06:30

Thanks! Cherry is my favorite too I've perfected the whole 1st 8x8 with it

P#89440 2021-03-24 12:19
1

This is a very unique way of doing a rhythm game. The presentation, music, and artwork are all great. I enjoyed it!

P#89663 2021-03-27 03:42

Thanks! i'm glad you liked it (btw, your comment made me play the web build and i dicovered a bug, so thanks for that too lol)

P#89678 2021-03-27 16:22

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-02-22 05:07:08 | 0.012s | Q:21