I've been searching around various forums and can't seem to find a definitive answer. Is it possible to set up Pico 8 to boot directly into a game, and have it run automatically? Pico 8 is an awesome platform for writing silly applications and I would love to make a dedicated hardware setup that boots directly into one of these applications (think: cosplay gadgets!). Anyone have experience with this?
Several updates, but one new curious problem:
I'm attempting to transition the player to a third scene (the second floor of the yurt), which sets player.x=#, in this case around 340, which is the appropriate x value relative to the area of the map I've used to design that scene. However, it appears using the code I've designed (which has worked just fine for transitions between the first and second scenes) the largest X coordinate value I can assign in this transition method is x=295. Setting to x=296 causes the player to become stuck, and no button input is registering. Its almost as if the draw method is no longer working at that point, because the player doesn't move at all. Typically when I've accidentally made the player's coordinates persistent, pushing in the directions still causes the directional animations to play out, but not in this situation. Is this a known issue that I'm unaware of, asking the player's x value to be set higher than 296? If so, how do we get usage out of the total map area? I'm at a loss here.
Davbo with the win!
Needed to use elseif to split the two different condition sets for the door transition. It works like a charm, and was just as simple of a fix as I suspected it would be. Yeesh.
Time to program the interactive objects for multi-purpose use (computer, dresser, any other items I can come up with for this "tech demo").
Uploaded now is a version where I've commented out the attempt to return the game state to the first level, at around line 304 in-code. As you can see, the transition works perfectly one-way, I just want to be able to return the game state to its original form when interacting with the "transition" object while in the "yurt interior" game state. It really seems like it should be simple, but there's some arcane order-of-operations stuff that I'm ignorant to thats preventing me from making it happen.
Anyone willing to have a look?
I've basically arranged everything as I'd like, and am ready to begin creating scenes that are more than simply tech demos for programming purposes. I've run into an issue that should likely be resolved by discovering an already-invented wheel, if someone can point me in the right direction.
A flag (game.stage) is set to a string ("island" or "yurt") depending on which scene I'd like to depict. Modifying this flag occurs when the player is "proximal" to an object called "transition". In the most update to date code I have, I'm attempting to set the flag to game.stage = "yurt" if the transition object is interacted with only if the currect game.stage=="island", and then vice versa. You can see my attempt at this at around line 295 (using Atom which I believe is offset three lines from what PICO-8 sees).
From what I can tell is happening, the program checks to see if btnp(4) and transition.proximal and game.stage=="island" and attempts to make the transition, but as-designed it loops through the next if-statement and resets game.stage back to "island". I would have though that using btnp() would prevent this from happening, but I must be failing to understand how this is working. As I have it written now, it seems like it should "just work", but... alas.
Here's where the already-invented-wheels might come in. Hopefully I've explained this simply so that it can be understood easily. How do I achieve what I'm attempting to do without the btnp(4) causing the scene to switch and switch back in one go? I can tell its partially working because one of the effects of switching to game.stage="yurt" is that the player's coordinates are reset per lines 303 and 304.
Anyone willing to review and advise?
Shifted to a system where every actor / object will be created at _init(), plotted onto the absolute X/Y coordinates of the map system, rather than screen real estate. When interacting with transition object the camera and map are adjusted as necessary to actually transition to the next scene on the map. Objects like the mom and dad characters can be moved when the scene.counter variable changes, but the may simply be left behind if no longer needed. I suspect as the little game scenario plays out that certain actors will need to be relocated for further narrative interaction.
One of my last issues was figuring out how to move the player along with these transitions without the new coordinates being persistent and thus keeping the player trapped in place. It seems obvious now, but adjusting the player's coordinates in the check for interaction with the transition object associated with a btnp() to trigger did the trick.
Bridgs' object creation method appears to work great when the only time it is called is on _init (once), otherwise it creates a new object every time the game updates. Using the coin collection method she created where the object is only drawn when a certain variable is true (or not false..), I was able to adapt that for when to show the invisible barrier objects on the island. This means I had to create new invisible barrier objects for any other scenes to come, like the yurt interior that is transitioned to when you enter the door, so thats less than ideal
The _draw() function works just fine for drawing non-interactive props like the moving waves and the computer inside the yurt, and for establishing what cls() color to use, what section of the map data to draw to the screen, etc. It can't be used to call additional objects though, and apparently neither can the _update() function, as these care called constantly, creating more and more iterations of the objects that are created using the make_game_object function.
I can continue to adapt this for my purposes, but I think perhaps a meaningful further piece of guidance in any further tutorials in this series from bridgs (thanks again!) would be more ways to interact with the objects as designed in the tutorial, namely to move them! All I'd like to do is move existing objects! Clearly there's something about the method as-designed that I'm failing to comprehend or grapple with.
Made several additions.
I've changed the invisible barriers to a highly visible sprite for testing, and added a teleport block that when proximal to and btnp(4) changes the scene to the interior of the house, as a means of transitioning.
As the barriers, player and "mom" and "dad" actors are created with the "make_game_object" function from bridgs' excellent tutorials (but not created by me...) I do not fully understand how to manage moving those objects when transferring from the first scene to the next. I can manage removing the sprites that are simply drawn to the screen only when the first scene is active, but the other interactive objects I'm stumped on. I'll have to keep reviewing bridgs' tutorials and get a better understanding of the syntax and how to continue to adapt it for my purposes.
My best estimate is that due to how the player, barriers, mom/dad are initialized to the screen, my method of transitioning from one scene to another won't be able to affect those objects without changing some states and values of their properties as established in the "make_game_object" function as it relates to each specific object. Lots more to ponder.
Definitely a great way to learn this, but also poses some challenge when you don't fully understand shared code..
Special thanks to @bridgs_dev for her excellent tutorials on Youtube. I've converted my first piece of learning script from last year to utilize her game logic, and have made my own alterations. My previous attempt was --terrible-- and running into her tutorials delivered a better method to accomplish the same things I was trying to do, and even showed me the "right" way to do it, as well as clued me in further on Lua syntax. I'm improving!
I'm posting this basically just to keep her updated. Still absolutely a work in progress.
I don't intend to create an RPG or anything of that sort, but closer to a "visual novel" or a mix between a top-down action game and a point-and-click adventure.
I intend to make a series of these types of "games" and have the scenarios be "social stories", which are a teaching tool for Early Childhood Education. Most of them you can find out there are incredibly rudimentary 4-6 page doodled comics showcasing appropriate behavior or short narratives about how a child should tackle a problem or situation. I think PICO-8 is perfect for doing this in a far more entertaining way.
New user here, and absolutely in love with Pico-8!
Having followed several available tutorials online, I've cobbled together a few concepts to get this game running. Its just a player moving around a game field with some actors standing in the first screen. The player is repelled by the actors, which is sortof how I want to handle collision between the player and most objects. I may tweak that depending on what the player is bumping into.
I'm posting here because I've run into a dead end with my attempts to change the map displayed on screen. I intend to set triggers that switch what area is displayed on the screen (like the player walking onto a door tile), but currently I'm trying to figure out the necessary code to change what is displayed while the "trigger" is tied to btn4.
As you can see in the referenced WIP cartridge, scene_counter is set to "1" in _init, and if scene_counter == 1 then the map region (0,0,0,0) is drawn to the screen. However, if btnp(4) then the map region is changed to (16,0,0,0), which is the next region on the map data I'd like the "scene" to be framed at. With my current code the map background is changed correctly (and an empty desert scene is drawn, with marker-tiles on the outer corners to ensure I've set the new map coordinates correctly), however --
As you can see (if you run the game and press Z) the map is changed but the player appears to still be interacting with the constraints of the previous map scene on the island. Moving up and down, you still interact with the screen as if the two NPC actors are still present, and as if you are still on the island with the un-walkable water tiles and the yurt present in the center. You should don't see them.
I'm curious if anyone can review my code (and identify which tutorial I pulled the concepts from ;) ) and assist me in identifying why my game is showing the map correctly, but not actually moving the coordinates of where the action is taking place to the correct region in the map-editor data? Am I understanding whats happening correctly?
Any assistance would be great, and any constructive criticism would also be helpful. As a side note, it should be painfully obvious from my code that I'm a novice to any and all programming and could probably get done what I'm doing here with shorter code, likely with more advanced methods. I'm manually checking a lot of coordinates for my "collision detection", which works but is taking up more tokens that it probably should.
As an additional note, please ignore my in-code comments at the beginning. They're mostly just for me so I don't forget how the heck this all works, and more then a bit pretentious.
Thanks, and enjoy!