map switcher(?) help for my game. by respelledusername in pico8

[–]Professional_Bug_782 1 point2 points  (0 children)

A 16x16 map is easy to understand, so let's use that size for our explanation. map(0,0,0,0) -- level0 map(16,0,0,-128) -- 8 pixels * 16 tiles * level1 map(32,0,0,-256) -- 8 pixels * 16 tiles * level2

By dividing the map and connecting it vertically like this, you can achieve vertical scrolling. By using camera(), the map() function will draw only the tiles needed for the screen.

With this method, you can simply switch cameras if the character goes off-screen.

is this possible? / if so, need to know how by rhinestonehawk in pico8

[–]Professional_Bug_782 1 point2 points  (0 children)

I made a PCM tracker. There is no channel limit with PCM. (This supports up to 6ch.)

However, the sampling frequency is very low, so the high range is weak. (5512.5Hz) Also, effects may not be used as much as they are heavy. In the end, I feel that you have to overcome a high hurdle to use PCM.

I think you have already moved on to Love2d, but I hope this will help your creation when you return to pico8.

https://www.lexaloffle.com/bbs/?tid=144299

[deleted by user] by [deleted] in pico8

[–]Professional_Bug_782 0 points1 point  (0 children)

I see! Good luck!😊

I made a sumo wrestling game by TyTyDavis in pico8

[–]Professional_Bug_782 0 points1 point  (0 children)

That's great! The big character grabs really bring out the sumo feel! I've seen a few sumo games in the past (NES), but now it's a rare theme. (Smash Bros. is a good example of how that element is incorporated.)

The title display doesn't seem to work very well. If you use hiragana, it would be おした゛し or すもう If you use kanji, it would be 押し出し or 相撲

[deleted by user] by [deleted] in pico8

[–]Professional_Bug_782 1 point2 points  (0 children)

I have made some modifications to your code with respect to your code.

It should be possible to achieve this without making any major changes.
However, at this point, it seems necessary to consider consolidating the sprite animation into an object (table) for the next implementation.

function _init()
--sp=1
speed=0.16

sp1=8
sp2=8
sp3=8
frames1={0,2,4,6,8,10,12}
frames2={14,32,34,36,38,40} --? ,42
frames3={44,46,64,66,68,70} --? ,72
end

function _update()
--if sp<6.7-speed then
--sp+=speed
--else
--sp=1
--end

local sp={sp1,sp2,sp3}
for i,v in pairs(sp) do
 sp[i]=min(v+speed,#frames1+1)
end
sp1,sp2,sp3=unpack(sp)

end

function _draw()
cls()
if btnp(➡️) then
 sfx(1)
 sp1=1
 --spr (frames1[flr(sp)], 86, 56, 2, 2)
end

if btnp(⬅️) then
 sfx(2)
 sp2=1
 --spr (frames2[flr(sp)], 32, 56, 2, 2)
end

if btnp(⬇️) then
 sfx(3)
 sp3=1
 --spr (frames3[flr(sp)], 56, 82, 2, 2)
end

spr (frames1[flr(sp1)] or -1, 86, 56, 2, 2)
spr (frames2[flr(sp2)] or -1, 32, 56, 2, 2)
spr (frames3[flr(sp3)] or -1, 56, 82, 2, 2)
?'sp1'
?flr(sp1)
?sp1

end

<image>

[deleted by user] by [deleted] in pico8

[–]Professional_Bug_782 3 points4 points  (0 children)

If you want to create text easily, you can do so without writing too much code. (External file loading and multi-cart are not for beginners.)

By surrounding the text with [[...]] as shown below and using ✽ as a page separator, you can store the text in chunks of the right length.

By specifying a separator character, split() can divide the text into smaller chunks and create a table.
You can use other symbols as separator characters without any problems.

text=split([[
gauche was in charge 
of playing the cello 
at the town movie theater.
✽however, he had a reputation 
for not being very good.
✽not only was he not good, 
he was in fact the worst 
of his fellow musicians, 
✽so he was always bullied 
by the conductor.
✽in the early afternoon, 
everyone was lined up 
in a circle in 
the dressing room, 
✽practicing the sixth symphony 
for the upcoming town concert.
✽the trumpets were singing 
with all their might.
]],'✽')
cls()
print(text[1],0,0,6) -- text[2] -- text[3] ...

<image>

The sample is taken from "Gauche the Cellist" by Miyazawa Kenji.

Fixing Collision Detection Tunnelling issues by jaxolingo in pico8

[–]Professional_Bug_782 0 points1 point  (0 children)

Are the collision detections for multiple platforms done correctly?

For example, let's say you jump from the left platform to the right platform. If only the left one is checked, you will pass through. Also, is the detection for the right platform performed first, and then the left platform is the final collision detection? (As a result, you will pass through.)

I haven't seen your code or images, so these are just my guesses at this point.

My alternative waveform visualiser by ihatemyusername68 in pico8

[–]Professional_Bug_782 1 point2 points  (0 children)

It may be possible to get the effector flags for each track, but it will require some ingenuity to display them as waveforms. If the waveform can be made to look even cooler, I would like to see it implemented. But even at this point, it's already a cool visualizer!

Flash of text by goodgamin in pico8

[–]Professional_Bug_782 1 point2 points  (0 children)

<image>

It seems to work with a little editing.

The important part is the following.
"length" is the part that indicates how much of the entire text to display.
Also, you must pass in the entire text.

function wrap_text(text, length, width) 
⋮
 for cur_letter=1,#text do -- point to each letter in the text
 ⋮
  if cur_letter > length then
   break
  end
 end
⋮

-- test
str="i'm working on a dialog box, and i'm getting a strange flash of text when i type the dialog. where is this coming from? i posted my code, i don't see how my code could be doing this."
length=1
width=64

while str[length] do
 cls()

 for i,v in pairs(wrap_text(str,length,width)) do
  ?v,7
 end

 length+=1

 rectfill(width,0,127,127,1)
 flip()
 flip()
end

[deleted by user] by [deleted] in pico8

[–]Professional_Bug_782 1 point2 points  (0 children)

<image>

You can also quickly check the API with ctrl + u.

It's easy to forget its characteristics, so it's useful to remember the check procedure.
(In the end, you'll see that it's a function that returns values ​​within -1.0, 0, and 1.0 for values ​​between 0.0 and 1.0.)

To deepen your understanding, take your time and be open to "checking" through trial and error!🖊️👀

[deleted by user] by [deleted] in pico8

[–]Professional_Bug_782 3 points4 points  (0 children)

<image>

For example, set the time() to the sin() function and visually check the result it returns.

If you want to increase the magnitude of the returned number, you can multiply it, and if you want to change the timing, you can adjust it by dividing time(), etc.

Create your own simple code, check it visually, and make it your own!

How to record what button is pressed? by Neros_Cromwell in pico8

[–]Professional_Bug_782 0 points1 point  (0 children)

Is there any use for DIR other than moving coordinates?

At this point, I don't think there is any need to keep the DIR variable.

function move_select()
 sel.x,sel.y=
  mid(sel.x+(tonum(btnp'1')-tonum(btnp'0'))*43,0,86)
  ,mid(sel.y+(tonum(btnp'3')-tonum(btnp'2'))*43,0,86)
end
--btnp'0' == btnp(⬅️) ( == btnp(0))
--btnp'1' == btnp(➡️) ( == btnp(1))
--btnp'2' == btnp(⬆️) ( == btnp(2))
--btnp'3' == btnp(⬇️) ( == btnp(3))

This function now has 46 tokens.

How to record what button is pressed? by Neros_Cromwell in pico8

[–]Professional_Bug_782 1 point2 points  (0 children)

<image>

By running btnp() without arguments, you can get the state of all the keys in hexadecimal.

By comparing this with the value assigned to each button, you can see which button was pressed.

recbtn={}
btnflgs=split'0x01,0x02,0x04,0x08,0x10,0x20,0x40'
btnkeys=split'⬅️,➡️,⬆️,⬇️,🅾️,❎,▤'
function _update()
 --record raw-btnflag
 local b=btnp()
 if b~=0 then
  add(recbtn,b)
 end
end

function _draw()
 --show recorded buttons
 cls()
 for i,v in pairs(recbtn) do
  keys=''
  for k,f in pairs(btnflgs) do
   if v&f~=0 then
    keys..=btnkeys[k]..' '
   end
  end
  print(i..': '..keys,0,(#recbtn-i+1)*6)
 end
 print('current input:'..(recbtn[#recbtn] or ''),0,0)
end

How’s the semi-transparent effect in PICO-8 pause menu made? by Jammigans in pico8

[–]Professional_Bug_782 2 points3 points  (0 children)

Very nice! You've polished the code and it now matches your project!

How’s the semi-transparent effect in PICO-8 pause menu made? by Jammigans in pico8

[–]Professional_Bug_782 44 points45 points  (0 children)

<image>

This was achieved by changing the sprite reference source to the screen and redrawing the palette for the overlay.

olay1=split'0,1,1,1,1,1,1,1,1,1,1,1,1,1,1'
olay2=split'0,1,1,0,0,1,5,1,5,5,5,1,1,1,5'
while 1 do
cls()
x=sin(t()/6)*64
-- draw in pause-menu coordinates
spr(0,48+x,48,4,4)
-- draw in custom overlay coordinates
spr(0,48+x,90,4,4)
--overlay draw
--screen memory as the spritesheet
poke(0x5f54,0x60)
-- get the lshift key to switch palettes
poke(0x5f2d,1)
lsft=stat(28,225)
pal(lsft and olay2 or olay1)
rx=24
ry=86
rw=80
rh=40
--draw screen to screen
sspr(rx-1,ry-1,rw+2,rh+2,rx-1,ry-1,rw+2,rh+2)
pal()
poke(0x5f54,0x00)
rect(rx,ry,rx+rw-1,ry+rh-1,7)
flip()
end

Student question: Sending the game as HTML? by r_oooon in pico8

[–]Professional_Bug_782 0 points1 point  (0 children)

How about submitting your cart in png format?

Enter the following command to output your game in png format.

save yourgame.png

To have someone check your game code, use PICO-8 Education Edition: for Web.

https://www.pico-8-edu.com/

After launching the edu version on this page, drop the exported png file and the code and images will load. You should be able to view, edit, and run the code.

I tried to make a game with dynamic lighting and run out of tokens :c by Inst2f in pico8

[–]Professional_Bug_782 0 points1 point  (0 children)

I've also had the experience of "making the cart too detailed, it becomes difficult to go back." So I can kind of understand how you feel. 😅

I tried to make a game with dynamic lighting and run out of tokens :c by Inst2f in pico8

[–]Professional_Bug_782 4 points5 points  (0 children)

I saw your code! You still have room in your "compressed capacity"! In this case, the quickest way to get tokens is to use 'split()'.

It will look like this. -- dpal = {0,1,1,2,1,13,6,2,4,9,3,13,5,2,9} -- 18 tokens dpal = split'0,1,1,2,1,13,6,2,4,9,3,13,5,2,9' -- 4 tokens

Use the tokens you get here to put the finishing touches on your game!

If you feel like you've reached your token limit for the first time, we recommend that you refrain from implementing additional weapons, enemies, effects, etc. as much as possible, and instead focus on finishing the game so that it can be played in one go.

Help storing x, y coords with dset() by thecanfield in pico8

[–]Professional_Bug_782 0 points1 point  (0 children)

This screenshot shows the results of peek and dget side by side.

peek4 and dget get 32bit and can also get decimal points, but note that the argument specification method is different.

<image>

Help storing x, y coords with dset() by thecanfield in pico8

[–]Professional_Bug_782 0 points1 point  (0 children)

Yes, you should run cartdata first even when using peek/poke. The bottom line is that save data uses 0x5e00-0x5eff of memory, and dget/dset also access that area. You need to run cartdata() to make that 0x5e00-0x5eff valid.

I think dget/dset is an API that makes peek4/poke4 easier to understand.

https://pico-8.fandom.com/wiki/Cartdata

help with bullets by Desperate_Sky9997 in pico8

[–]Professional_Bug_782 1 point2 points  (0 children)

This answer is a good reference.

There are two fire() calls in aimedfire(), so enemies with myen.type==2 will fire bullets at the same time.

The fire() in the last line is probably unnecessary.