Log In  
Follow
Astorek86
Follow

I'm not sure if I should post this here or in the "Tutorials"-Section, but I think it better fits here:

Cart #pimegutezu-0 | 2022-01-15 | Code ▽ | Embed ▽ | No License
2

I wanted to show a way on how to do Map-Collision, using the Flag-System in PICO8. This Function also takes care if your Sprite is wider or taller than 8 Pixels.

Basically you give a Function a few Parameters (like Position, Width & Height from the Player) and this Function checks the Flags from the Tile-Map on certain Pixels, depending on the Player-Position and it's Width/Height. You can use the Return-Value from this Function to allow or deny Player-Movement.


Before I show the "How-To use the essential Function", there's some preparation that you need to do.

For example, you have a Table called "Player" (like in a few NerdyTeacher-Tutorials) with some Variables, like:

player = {}
player.x = 3
player.y = 4
-- etc.

This needs some Addition to properly use the Collision-Function:

  • "w" for the Width of the Sprites in Pixels Minus 1.
  • "h" for the Height of the Sprites in Pixels Minus 1.
  • "ox" for Offset-X of the Sprites (black/transparent color) until Character starts - from left.
  • "oy" for Offset-Y of the Sprites (black/transparent color) until Character starts - from top.

Example for this Cart:

player = {
  w=3,
  h=13,
  ox=2,
  oy=1,
}

Why these Values? Because:


For your own Sprites, you can change these Values as you like.


After that, I can show the Function I mentioned:

is_solid(opt,f,ox,oy,flags,debug)

This Function can be called if you want to check if a Map-Collision happened and returns TRUE if detected, otherwise FALSE.

A quick description of the Parameters:

  • opt == a String that describes on which places should the Collision be checked. Possible Values are:
    • full, left, right, up, down, lup, rup, ldown, rdown
  • f == Usually the Player in a Table. Generally a Table that contains at least:
    • w, h, ox, oy
  • ox and oy == Offset-X and Offset-Y, that will automatically be added to the "Calculation" of the Map-Collision.
    • This is really useful to check a possible Player-Movement, but BEFORE the Player has moved. You can check if Player-Movement to the "ox"-/"oy"-Position are possible without Collisions. If so, move the Player to the new Location...
  • flags == A Number or a sequential Table of Numbers, which represents the Flags that will be checked for the Map-Collision.
    • It works like this: If this Parameter has a Table like, for example {1,2,0}, it will check if the Tile has the Flag 1, OR the Flag 2, OR the FLAG 0 activated. If the Collision-System finds at least one Tile where at least one Flag is activated, the Function will return TRUE.
  • debug == Boolean. If true, it will draw red Pixels to the "Collision-Positions". Useful for Debugging and Testing.
    • If you do that, then you should do that inside the _DRAW-Function. Keep in mind that this Function doesn't block anything, it just checks the Pixels around a Sprite and reads the Tile-Flags from these.

How to use it

First things first: You set up the _INIT and initialise the Player:

function _init()
 player = {
  x=5*8,
  y=2*8,
  w=3,
  h=13,
  ox=2,
  oy=1,
 }
end

Of course, modify these Values as you like to match your own Sprites.


Inside the _DRAW-Function, simply clear the Screen, draw the Map and the Player-Sprite:

function _draw()
 cls()
 map()
 spr(1, player.x, player.y)
end

If you want a Debug-Output for the Collision Detection, you can add this Line in the 2nd last Line:

 is_solid("full",player,0,0,{},true)

Inside the _UPDATE-Function, first thing to do is check Player-Input and saving them in Variables:

function _update()
 local dx,dy=0,0
 if(btn(⬅️))dx=-1
 if(btn(➡️))dx+=1
 if(btn(⬆️))dy=-1
 if(btn(⬇️))dy+=1

After that, you can check if the new Location (that's the Location where the Player wants to move) has no Collision. If that's the case, you can simply move the Player to the new Location:

First, the X-Coordinate

 if not is_solid("full",player,dx,0,7) then
  player.x+=dx
 end

Parameters are "full" for a "full-sprite-check" to the new Position, player for the Player-Table, dx for the additional Movement-Position (because we won't wanna check the "old" Player-Position for Map-Collision, we wanna check the new Location if there's a Map-Collison...). 0 is the Additional "Offset-Y". We wanna check this Value a little bit later (the Reason will be explained soon*). The last Parameter 7 (could also be {7}) checks the Flags of the Tiles. If one Tile has the Flag "7" activated, the Function will return "TRUE", the Line after the IF-Command wouldn't be executed and the Player won't move to the new Position.

The last four Lines inside "_UPDATE" are:

 if not is_solid("full",player,0,dy,7) then
  player.y+=dy
 end
end

It's basically the same as before, but now for the Y-Position.

*Maybe you have the Question "Why do we check X and Y seperately?". Because you won't completely stop the Movement if you bump into a "forbidden" Tile. For example, if you move diagonally and check the OX- and OY-Collision at the same time, the Player will instantly stop moving around. I think for the sake of "Game-feel", it's better that the Player could "Slide around" on the Tile...


Hope this Example could be useful for you. I included some additional "flavors" on the Cartridge (like Flipping the Sprite on X and Y, and drawing the Sprite in the right size depending on the previous discussed Values), but it's basically the same as the Example I described^^. Cartridge is also commented as well.

Would like to hear Feedback and Stuff. Also if you found an error (I hope there are no errors^^) please let me know. Use the Source as you like^^.

Last but not least, the whole Stuff without any comment for Copy'n Pasting:

function is_solid(opt,f,ox,oy,flags,debug)
 local collist={}
 ox = ox or 0
 oy = oy or 0
 flags=flags or {0}
 if(type(flags)!="table")flags={flags}
 local ix=f.x+f.ox+ox
 local iy=f.y+f.oy+oy
 for x=ix,ix+f.w+7,8 do
  for y=iy,iy+f.h+7,8 do
   if opt==nil
   or opt=="full"
   or opt=="left" and x==ix
   or opt=="right" and x>=ix+f.w
   or opt=="up" and y==iy
   or opt=="down" and y>=iy+f.h
   or opt=="rdown" and y>=iy+f.h and x>=ix+f.w
   or opt=="ldown" and x==ix and y>=iy+f.h
   or opt=="rup" and y==iy and x>=ix+f.w
   or opt=="lup" and y==iy and x==ix
   then
    add(collist, {x=min(x,ix+f.w), y=min(y,iy+f.h)})
   end
  end
 end
 if(debug)print(#collist)
 for c in all(collist) do
  if(debug)pset(c.x,c.y,8)
  for v in all(flags) do
   if(fget(mget(c.x/8,c.y/8),v))return true
  end
 end
 return false
end

Wish you a good day! :)

P#105154 2022-01-15 23:51

Hey there,

A Feature Request for the PICO8-Users out there which use a Handheld (like Anbernic RG351P/M/V) to play PICO8-Games:

Normally, you can start every Cartridge directly using "-run" in the Command Line:

pico8 -run some_cartridge.p8

On Handheld-Devices, that's great, because you can Pause and Shutdown PICO8 with the given Controls.

HOWEVER: I was able to run a Cartridge that "crashed" PICO8 (means it shows some Lua-Errors and the Program stops running). But after that Crash, PICO8 doesn't quit, instead it throws me into the Command line, like:
(example crash)

But that's not good if that happens on a Handheld, because you have no opportunity now to close PICO8 without a Keyboard (or something hacky like SSH etc.). After that, I have no other choice than Poweroff that Handheld and hoping that the Filesystem on the SD-Card don't get corrupted.

P#95133 2021-07-21 16:11 ( Edited 2021-07-21 16:22)

Hello there,

Krystman made an excellent Game called Porklike, you can find it here: https://www.lexaloffle.com/bbs/?pid=94445

I made a mod to this game which adds a german translation to it. Right after the Game starts, you'll be asked on which language you want to play.

I would've liked to add some more Functionality (like, a menuitem), but there wasn't enough tokens left to do so^^.

Here's the Mod:

Cart #porklike_de-4 | 2021-08-30 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
5

Changelog:

porklike_de-4

  • Oops, the last Patch didn't fix anything ("save @clip" seems to work a little different...). Now THIS Patch does what the previous Patch describes^^.

porklike_de-3

  • "Slap" ("Ohrfeige") was mistakenly described as a Weapon that doesn't deal Damage. Fixed.

porklike_de-2

  • Forgot ":" after "Wurstchain"/"Wurstkette", which looks odd after finishing the Game ("Wurstchain1"). Fixed.

porklike_de-1

  • Somehow I didn't realised that the "Push"-Attack ("Stoß") is actually a ranged attack (though even the Original Text says that. Oops!). The German Description in the first Version doesn't tell you that, this Version does^^.

porklike_de-0

  • First release.

--

What and how did I changed on the code?

  • I have to make spaces for more Tokens, because the Original-Game has only 22 tokens left. Luckily, zep released a PICO8-Version that includes the "split"-command. Krystman used two Functions called "explode" and "explodeval" who does the same, so I replaced every "explode" with "split" and deleted these two Functions. After that, ~100 Tokens were here to use.
  • After that, there still wasn't enough tokens left for me, so I removed every "()" that weren't needed (like, split("XYZ") --> split"XYZ".
  • I want to use "german umlauts" (äöüß) on the Game, so I used the new ability to change the Fonts in PICO8. zep made a Cart for it: https://www.lexaloffle.com/bbs/?tid=41544
  • I also slightly modified the UI on the Game to have spaces for the translated words. German translations need more place^^.
  • There's a place in the Code where I used a "mid"-command, to prevent showed text Off-Screen.
  • An obvious one: Every word was put in a table, and every "print"-command uses the table. Easy^^.
  • There are a few Codes that are written like this in the Original Game:
    add (x, y)
    return y

    I had to change it on one or two places in the code ("return add..."), to squeeze a few more tokens out of the File.

I really hope that I didn't write a few bugs on accident. I played this changed Cartridge a few times and never found a bug. (But I never reached the end, because I'm too bad in this Game^^).

P#94539 2021-07-07 07:21 ( Edited 2021-08-30 12:04)

Hey there,

In the 0.2.2 release, zep made a small tool for creating custom fonts:
https://www.lexaloffle.com/bbs/?tid=41544

I'd like to just slightly modify the Original-Font that provides PICO-8 by itself. I thought I could find an easy way to implement the Original-Font into the Spritesheet... But it seems there's no easy way to do so? And nobody did this before? So I decided to modify the Spritesheet, include the Original-Chars with it.

It SHOULD be the Original-Chars; if you find an error (misplaced Pixel or something like that), feel free to tell me so I can fix this :) .

--

While running PICO-8, type

import #font_orig

to load the newest Version of the Cartridge.

Cart #font_orig-2 | 2021-07-06 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
5

EDIT: Of course, feel free to use it as you like^^.

Changelog:

font_orig-1

  • Just forgotten to capture the Label.

font_orig-2

  • "U" was wrong; fixed.
P#94510 2021-07-06 08:13 ( Edited 2021-07-06 08:57)

Hi @ all,

I like those old "Oddworld"-Games ("Abe's Oddyssey" and "Abe's Exoddus"). Just experimenting with a "Gamespeak"-like Control:

Cart #picodokon-0 | 2021-04-07 | Code ▽ | Embed ▽ | No License
1

Absolutely nothing is finished, just the Gamespeak, Collision and the Animation works. No Gameplay so far.

For Gamespeak, hold Z and
UP: "Hello"
RIGHT: "Follow Me"
DOWN: "Wait"
LEFT: "Everyone"

I really want to make an Oddworld-like Demake, but I can't promise anything^^. I'll try to work on that Project^^...

P#90143 2021-04-07 21:22

Cart #shadowrepeatsyou-0 | 2021-01-03 | Code ▽ | Embed ▽ | No License
6

Entry for the One Hour Game Jam 297th, Theme: Follow.

https://onehourgamejam.com/

A Shadow is following you, and you need to reach the Goal. Your Shadow(s) also need to reach a Goal.

Note:
It took me four Hours instead of only one to make this Cart. It would be dishonest to other Jammers if I would hide that fact^^.

I like the Idea, maybe I'll work on some more Levels and a better presentation, but I really don't know atm^^.

Have Fun!

P#86087 2021-01-03 00:38 ( Edited 2021-01-03 00:39)

Cart #meas_castle-15 | 2022-03-13 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
99

Mea's Castle

Mea's Castle is a Metroidvania-like Game: You're a little Adventurer and your Goal is to find the "Cup of Hope". You can run and jump, and soon you will find some Artifacts that'll give you more Abilities.

🠔🠖 - Move
🠗 + 🠔🠖 - Crouch
(Z) - Jump
(X) + 🠗 - Use the last Powerup

Warning
This Game is difficult. If you're not a Fan of Jump'n Run-like Games, I think it will be too frustrating^^. There are still Checkpoints basically everywhere, but it's still not easy to beat that Game. Expect to die a lot while playing this^^.

Credits

Thanks to

Other stuff

Also, if you like to cheat, you can use

the Konami-Code on Mainmenu to become invincible ;)

Reset the Cartridge (P -> Reset Cart) and do this:
⬆,⬆,⬇,⬇,⬅,➡,⬅,➡,X,Z

If you did it right, you'll hear a slightly different Sound.

Also, here's the Map of the Game. Altough I'm not sure if it's that useful here^^:


Start-Position is where the Map says "Hi":

Hope you'll have Fun with that little Game^^.

Enjoy!

Changelogs

New in v1.11
  • Just a little "saved"-Message after reaching Checkpoint or Artifact.
    if no serious bug is found in the future, this will most likely the last Version I upload. Because I have used all the available Tokens, there are no tokens left anymore^^.
New in v1.10
  • New: Game will now save your progress after you reach a Checkpoint, collect an Artefact or being hit by an Enemy/Spike. If Progress exist, you can continue from the Mainmenu. (If you want to reset your progress, finish the Game or open the Pause-Menu (P) and select "del save+reset".)
  • Swap X/Z through the Pause-Menu will also be saved.
  • Using Doublejump has now an Indicator (Mea's Shirt is now Dark-Red until Doublejump is available again).
  • After a Respawn from a Checkpoint, Mea could jump immediately and without a Button-Press due to the Coyote-Time that wasn't cleared. Fixed.
  • On Devices that don't fully reach 60 FPS all the time, the "Fade"-Script will now work as intended. It will never leave the Area half-lighted until the end.
  • After collecting the Key-Artefact, some places are now locked away from the Player, preventing to wander around and get lost on Levels that the Player needs to visit never again^^.
  • Slightly modified the Credits.
New in v1.09
  • Just a graphical Change: Cannons now "blink" just before they fires.
New in v1.08a
  • Fixed "Slide Down"-Animation facing on wrong Direction, Thanks to Some1NamedNate for finding out that bug!
New in v1.08
  • Just some more graphical stuff: Little changes on Titlescreen and Checkpoints. There's also a Checkpoint-Animation if the Player dies.
  • Also I like the idea that the Castle looks more and more "holey" the more Powerups the Player has. Just a subtle Change in the mood I guess^^.
  • Checkpoints will now always been activated, even while the last Powerup is activated.
New in v1.07
  • Graphical Overhaul. Smooth Walls, Ceilings and so on, Thanks to Youtuber "Dev Quest" and his Tutorial!
  • Screen-Fades everywhere, Thanks to Krystman for his Code on the "Code Snippets"-Section!
  • Particle-Effects on Enemies and Bullets.
  • Particle-Effects and Sounds when Player slides down on green Walls.
  • Menu-Sounds, not just the Music alone.
  • Changed and added Dust-Animation for the Player.
New in v1.06
  • Fixed a Bug where the Game could freeze after leaving a Room near a "Door"-Tile. Thanks to MacadamiaMan for finding that Bug.
  • Fixed a Bug where the Game could freeze while using a treadmill.
New in v1.05
  • Added Coyote-Jump (you can still jump after running off the ledge, for a few extra frames). I really wanted to add that^^.
  • Wallslide-Animation only if the Player slides down.
New in v1.04
  • Performance-Update! Previous Versions uses around ~65% CPU-Usage all the time, is now reduced to ~30%. Now it's playable on slow Devices like a Raspberry Pi Zero.
New in v1.03:
  • Fixed a Bug where the Player couldn't use a Wall Jump on certain circumstances.
New in v1.02
  • Just forgotton to change the Title Screen^^.
New in v1.01
  • Replaced the last Level; it really wasn't that good^^. Thanks to bigjus for the Feedback.
P#81448 2020-09-02 18:24 ( Edited 2022-03-13 23:01)

I doubt that's an intended behaviour: After running a Cart that's using the "FILLP"-Command, every Draw in the Sprite-Editor that includes Pencil or Shape (the last one; not shown in the GIF) also uses this pattern:

On 0.2.1B, it's possible to use "fillp(█)" (or simply reboot) to solve that Problem...

(I was working on a Game and tried to change a Sprite, and I wondered that I suddenly couldn't overwrite some Pixels in the Sprite anymore. I was like "what the Hell is going on there?" until I discovered that^^)

P#81190 2020-08-26 00:24 ( Edited 2020-08-26 00:31)

Cart #juhatozuto-0 | 2020-08-08 | Code ▽ | Embed ▽ | No License
3

Entry for the One Hour Game Jam, Theme: Leave.

P#80523 2020-08-08 22:03

Cart #wajapayesu-0 | 2020-05-02 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
3

Entry for OHGJ 262th. Theme: Time Travel.

I really run out of time^^.

P#75757 2020-05-02 21:54

Hey there,

according from the Wiki-Page about Memory, it is unclear what a Poke to address 0x5f5e does, right?

 0x5f5e-0x5f7f / 24414-24447

 The remaining registers up to 0x5f7f are undocumented.

I was playing around a bit and found something out: It seems to "reduce" the Colors that can be used. For example, poking a "1" reduce the Palette to only 2 Colors, Black and Dark-Blue.

A simple Description: It seems that poking around 0x5f5e is some sort of "pal" all over the Color-Palette, but also prevents you to "pal" another Color. For Example: If you poke a "1", "pal" is limited to set a Color to blue or black only.

I just uploaded a Cartridge where you could play around with that:

Cart #poke0x5f5edemo-1 | 2020-05-08 | Code ▽ | Embed ▽ | No License
11

I didn't found anything about that address in PICO-8, so I thought, it can be useful for others and like to share that^^. (I already imagine some sort of "Switch the Game from a NES-like-Palette to a GB-like-Palette", or something like that^^.)

Cheers.

P#75691 2020-05-01 12:30 ( Edited 2020-05-08 07:54)

Entry for the One Hour Game Jam, Theme: 4 Colors only.

Swap colors to avoid Enemies.

Very short, because I run out of time^^.

P#75385 2020-04-25 22:14

Cart #endlessrunner-0 | 2020-03-14 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
14

Just experiencing with an "Impossible Game"- or "Geometry Dash"-like Prototype. Basic Gameplay works, but every other Thing is unfinished at this point^^.

P#73914 2020-03-14 09:15

Hello there,

(English isn't my first Language, I hope it doesn't sound too bad, Sorry^^)

I was looking for a easy Solution to "modify" the Linux in my GPi Case to boot directly into PICO8. I don't want to use something like Retropie/Recalbox/Lakka, just a PICO8-Machine.

There was already a Project called PICOPI, which already assembled that. But it seems this Project doesn't exist anymore (Homepage is down; the Files I could find on archive.org doesn't seem to work anymore).

So I thought I write my own Script for this, which builds upon Raspbian, the Default-Linux-Distribution for Raspberry Pi (which builds upon GPi Case). I thought it could be useful for others, so I uploaded the Script^^.

While using this Script, you will be able to put your .p8-Files directly on the "boot"-Partition on the SD Card.

Script can be found on Github, including a Manual for using it:

https://github.com/Astorek86/Pico8-Script-for-GPi-Case

EDIT: I also uploaded a Video on Youtube to show the Process:

https://youtu.be/JqRGS9bZfkg

P#73319 2020-02-21 17:58 ( Edited 2020-02-22 05:59)

Cart #fewosijoha-0 | 2019-08-30 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
3

Hello,

just testing some Slopes in a Jump'n Run-like Prototype.

Nothing's really finished yet, I'm just testing around^^.

P#67062 2019-08-30 23:09

Hey everybody! Just sharing a little Minesweeper-Clone that I've programmed^^.

New Version:

Cart #minesweeper-1 | 2020-03-05 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
12

Mouse is not required anymore, but you can use the Cartridge below if you wanna use the Mouse.

Controls for "Non-Mouse-Version":
- Arrow-Keys to move Cursor.
- Press and release X to open a Tile.
- Press and release O to mark a Tile (red or blue Flag).
- Hold X or O + Arrow-Keys to scroll.


And here the "Mouse-Version" of the Game:

IMPORTANT: Keep in mind that the "Mouse-Version" can be quite unplayable on Browsers. This Version of the Game runs best directly on PC, started by PICO8.

Cart #minesweepermouse-1 | 2020-03-05 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
12

Controls for "Mouse-Version":
- Left-Click to open Field.
- Right-Click to mark Field with a red or blue Flag.
- Hold Middle-Click (or Arrow-Keys) to scroll.
- You can use O to simulate Left-Clicks, X for Right-Clicks.

Game should fully works as expected, hope I didn't forget anything^^.

A few GIFs:

Just playing on normal Difficulty:


Scrolling with Arrow-Keys and Mouse:


Showing "Custom"-Menu for own Width/Heigth/Mines:

Hope you enjoy!

Changelog:
- Mouse isn't required anymore; there are now two Cartridges: A "Non-Mouse-Version" and a "Mouse-Version".
- Added an Animation when opening a Tile.
- Added Sound when opening a few Tiles at once.
- Optimization (Tiles won't be drawed if outside the Screen)
- Every Difficulty can now be reached through Pause-Menu

P#65119 2019-06-10 11:30 ( Edited 2020-03-06 17:36)

One Hour Game Jam - Theme: Island (2018-09-15)

There is not much you can do here^^. Just walking around, cut trees, craft a wooden Sword and kill Monsters with it. Description reads alot better^^.

P#56724 2018-09-16 05:32 ( Edited 2018-09-16 18:32)

Cart #53991 | 2018-07-07 | Code ▽ | Embed ▽ | No License

A little bit easier with less enemies:

Cart #53992 | 2018-07-07 | Code ▽ | Embed ▽ | No License

Submit for the One Hour Game Jam 167,
http://onehourgamejam.com

Theme: That's not supposed to be a weapon.

P#53989 2018-07-07 17:47 ( Edited 2018-07-07 22:48)

Cart #53741 | 2018-06-23 | Code ▽ | Embed ▽ | No License
4

Game of the One-Hour-Game-Jam.

Theme: 1 Object.

P#53742 2018-06-23 17:24 ( Edited 2018-06-25 14:34)

Cart #53614 | 2018-06-16 | Code ▽ | Embed ▽ | No License

Submit for the One Hour Game Jam

Theme: your favorite game but the most simplest possible

P#53613 2018-06-16 17:12 ( Edited 2018-06-19 23:26)

View Older Posts
Follow Lexaloffle:        
Generated 2022-05-20 13:14:29 | 0.114s | Q:81