Log In  
Follow
timeandspace
Follow
Starship v1.1
by timeandspace
Pico-Tron v1.1
by timeandspace
Pico-Bot v1.2
by timeandspace

I'm working on a collision routine for pixel based movement (not grid movement). There's no jumping, it's a from-above perspective:

if btn(⬅️) then
 if intersect(pl.crect1,cage_crect)
 and pl.crect1.x>=cage_crect.x+1 then
  pl.x1+=1
 end
 pl.x1-=1
end
if btn(➡️) then
 if intersect(pl.crect1,cage_crect)
 and pl.crect1.x<=cage_crect.x then
  pl.x1-=1
 end  
 pl.x1+=1
end
if btn(⬆️) then
 if intersect(pl.crect1,cage_crect)
 and pl.crect1.y>=cage_crect.y+1 then
  pl.y1+=1
 end 
 pl.y1-=1
end
if btn(⬇️) then
 if intersect(pl.crect1,cage_crect)
 and pl.crect1.y<=cage_crect.y+cage_crect.h then
  pl.y1-=1
 end
 pl.y1+=1
end

This seems to work OK, but I am not sure how to adjust it so that the player can move along the object, e.g. bottom of player intersects top of object rect, and if player holds down+left the player should still move left. As it is, my code won't register anything other than the opposite direction after the initial direction that caused the collision. I had a quick search for collision examples but didn't find anything that met all my criteria (pixel based + uses collision rects, not tiles). Anyone have any pointers?

P#83164 2020-10-20 17:35 ( Edited 2020-10-20 17:37)

As per title. I've made a piece of music that uses all 64 patterns, but when using the export wav option, only the first 54 patterns are dumped to wav.

P#83126 2020-10-19 17:04

Cart #starship-1 | 2020-10-22 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
8

About

Starship is my third Pico-8 game, and is influenced by old single screen ZX Spectrum games like Manic Miner, Jet Set Willy, and Jetpac. Gather all the ship parts scattered about each of the 20 stages. Take them back to your starship for repairs to transcend into outer space!

Tips

  • Skillful play will spawn a cosmic flower. Kneel before the cosmic flower to attain the gift of the cosmos.
  • Chasing score will make the game more difficult.
  • Don't tread on the worms!

Downloads

Downloads for Windows, Linux, OSX, and Raspberry Pi can be found on my itch.io page:

https://exq-bytes.itch.io/

Updates

v1.0 - Initial release
v1.1 - Added stage select

Request

If anyone is able to complete the game, please reply in this thread. I'm interested to see if I maybe went too far with the difficulty on some of the later stages. During testing, I was able to complete each individual stage without losing a life, but doing all 20 in one session will be quite the challenge!

P#82807 2020-10-11 21:32 ( Edited 2020-10-22 13:51)

As per title. After updating Win8.1 today I started getting this error when attempting to save a GIF. The only reference to this error on google says not to use special chars in your destkop path. There are only normal chars in my desktop path, so that can't be the issue. Anyone else seen this? It was working fine until I updated Windows. I also tried running as admin, but still no joy. This is the entry in config.txt:

// Desktop for saving screenshots etc. Defaults to $HOME/Desktop
desktop_path

edit: actually, I noticed something - when I replace desktop_path with a path that exists, save, then load pico-8, it gets overwritten with desktop_path. Maybe a bug?

P#81484 2020-09-03 20:37 ( Edited 2020-09-03 20:56)

I have an issue with collision detection when my character is falling, shown in the GIF below:

After a few jumping attempts, the player falls straight through the platform he is meant to land on. This is most likely because the fall rate accelerates, and the player/platform collision boxes aren't connecting. I'm setting the player collision box to a single line at the player's feet, like this:

This is to make it easier to detect if the player jumps through the bottom of a platform and lands on top of it.

Here's how I check for collision:

function plat_collision(o)
 for _,p in pairs(plats) do
  if intersect(p.crect,o.crect) then
   o.y=p.crect.y-8 --this is used to handle jumping through bottom of platforms
   return true
  end
 end
 return false
end

function intersect(rect1,rect2)
 if (rect1.x < rect2.x + rect2.w
 and rect1.x + rect1.w > rect2.x
 and rect1.y < rect2.y + rect2.h
 and rect1.y + rect1.h > rect2.y) then
  return true
 else
  return false
 end
end

And here's the bit in my update function :

if not pl.on_ground then
  --accumulate gravity
  pl.dy+=pl.grav
  --fall
  pl.y+=pl.dy
 end

 if pl.dy>0
 and not pl.on_ground then
  pl.is_falling=true
 else
  pl.is_falling=false
 end

 --if falling check if we have
 --hit a platform
 if pl.is_falling then
  if pl.y>121 then
   --stop player falling through bottom-most platform
   pl.y=115
   pl_landed()
  elseif plat_collision(pl) then
   pl_landed()
  end
 end

 --not falling, test if we are
 --stood on a platform
 if not pl.is_falling
 and not plat_collision(pl) then
  pl.on_ground=false
 end

Anyone have any pointers?

P#81449 2020-09-02 17:37 ( Edited 2020-09-02 20:24)

As per title. I don't have enough space in my sprite sheet to recreate the fonts, which I could just scale using something like sspr. Any other way to do it?

P#81348 2020-08-29 23:09

Cart #picotron-1 | 2020-08-27 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
17

About

Pico-Tron is my second Pico-8 game, and is an homage to the arcade classic Robotron, with a few extra twists added. Battle your way through 21 stages of chaos and destroy the evil genius Eugene!

Controls

Press to move your super destruction robot around the screen. Tap to rotate shot anti-clockwise, tap to rotate shot clockwise.

Collect These Things

Destroy These Things

Tips

  • Keep moving! It's easier for enemy homing shots to hit you if you're not moving.
  • Prioritise the most deadly enemy types on each stage.
  • Keep your distance from fast enemies that move unpredictably.
  • A bonus is awarded on each stage if you collect all innocents before destroying a single enemy.
  • To score high, you need to quickly eliminate the enemy that destroys the innocents.
  • If you focus only on score, the game will be much more difficult!

Downloads

Downloads for Windows, Linux, OSX, and Raspberry Pi can be found on my itch.io page:

https://exq-bytes.itch.io/

All-Clear

Here's a video of the game being completed that might be useful for anyone needing gameplay tips:

Updates

v1.0 - Initial release
v1.1 - Fixed a bug where high score wasn't saved if player completes the game.

P#81121 2020-08-24 19:01 ( Edited 2020-09-26 09:51)

Is multiple assignment possible within a table, e.g.

e={
 x,y,health,timer=0,0,0,0,
 score_val=100,
 colour=7
}

When I do that, for some reason the timer value is returning nil.

Or, is there a limit to the number of multiple assignments? I am currently setting 16 variables to zero.

P#80734 2020-08-14 00:57 ( Edited 2020-08-14 01:09)

Let's say I have an 8x8 sprite, like the one in my avatar. I want to manipulate that sprite as follows:

  1. Randomly position each non black sprite pixel outside the viewport.
  2. Move those pixels into the viewport to form the sprite.

I know how to do this with a whole sprite, but how might I achieve this effect with the individual sprite pixels? Obviously I'll need the following:

  1. Destination position of sprite within the viewport.
  2. The index position within the 8x8 grid of each pixel, offset from sprite destination position - e.g. x,y of sprite, then index of pixel within the sprite 8x8 grid.

Anyone have any ideas? I want this as a neat effect for spawning enemies at the start of each stage in a new game I an working on.

P#80560 2020-08-09 19:22

Here's my follow-up to my first Pico-8 game (Pico-Bot). This one is called Pico-Tron and will be a Robotron-style shooter. There aren't many of these types of games on Pico-8 so thought I'd try my hand at one. It won't be a slavish recreation, instead it will have lots of new features of its own. It currently has 13 enemy types, with around 790 tokens remaining that I might use for a few more enemy types. I still have the sfx and music to do too. Should hopefully have it finished soon.

P#80503 2020-08-08 13:04 ( Edited 2020-08-08 17:05)

I'm using the code below, but it's quite a lot of tokens when converted to Lua. Does anyone have a more compact routine for use with Pico-8?

http://www.jeffreythompson.org/collision-detection/line-rect.php

P#80424 2020-08-06 15:23 ( Edited 2020-08-06 15:23)

Cart #picobot-3 | 2020-07-26 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
8

Info

Here is my fist Pico-8 game: Pico-Bot. I made this over the last two months in my spare time. It's a sort of horizontal Space Invaders with platforms and more intricate scoring techniques.

How to Play

  • Destroy enemies and collect the orbs they drop.
  • The quicker you collect orbs, the higher your score.
  • Collect three large orbs to activate the score multiplier.
  • Tip: you're invincible while jumping between platforms.

Here's a video showing the game being completed to show that it is possible!

Other Platforms

You can download Windows, Linux, OSX, and Raspberry Pi builds from my itch.io page:

https://exq-bytes.itch.io/pico-bot

Update History

v1.0

  • Initial release

v1.1

  • Added a more eye-catching cart label.
  • Simplified drawing of logo by using sspr function to draw sprite sheet region.
  • Fixed a text alignment issue on title screen.

v1.2

  • Changed mines to prevent them spawning slightly off-screen.
  • Adjusted the difficulty slightly to make it fairer.
P#79659 2020-07-20 09:07 ( Edited 2020-09-09 12:26)

I'm trying to free up some tokens in my game by converting some tables to strings. Here's how I am trying to convert a string back to a table (which contains tables):

stgs="102,2\102,1"
for i=1,#stgs do
 if sub(stgs,i,i)=="," then
  sprite=tonum(sub(stgs,i-3,i-1))
  layout=tonum(sub(stgs,i+1,i+1))
  add(stg_defs,{sprite,layout})
 end
end

I would expect the output for the above code to be:

{
 {102,2},
 {102,1}
}

However, the actual output is:

{
 {102,2},
 {nil,1}
}

Can anyone spot what I'm doing wrong?

P#78740 2020-07-01 05:32 ( Edited 2020-07-01 05:33)

On Win/Mac it's possible to point your carts and high scores folders (in the pico-8 config) to a shared dropbox folder so you can keep your games collection and saves synced across multiple devices. Does anyone know how to do this with a ClockworkPi Gameshell?

P#78332 2020-06-20 15:32 ( Edited 2020-06-20 15:32)

I have enemies in my game that have behaviours - 1 behaviour function per enemy. Instead of defining the behaviour within the enemy class definition (waste of memory as the function will be created for each enemy of the same type) I want to define each behaviour once (outside the enemy class) and have each enemy instance hold a reference to its single behaviour. The enemy object needs to be able to send a reference of itself to the single behaviour function. I tried this:

function setup()
 enemy_group1={}
 for i=1,max_group_enemies do
  enemy={
   e.alive=false,
   behav=en_visit(self)
  }
  add(enemy_group1,enemy)
 end
 add(enemies,enemy_group1)
end

function en_visit(e)
 e.x+=1
end

function spawn(x,y,etype,edir,vel)
 for _,e in pairs(enemies[etype]) do
  if not e.alive then
   e.alive=true
   return
  end
 end
end

function update()
 for _,egroup in pairs(enemies) do
  for _,e in pairs(egroup) do
   if e.alive then
    e:behav()
   end
  end
 end
end

The en_visit function is correctly being called, but it isn't receiving a value for its parameter (e). The error reported is: attempt to index local 'e' (a nil value). Can anyone spot where I'm going wrong?

P#77862 2020-06-09 22:42 ( Edited 2020-06-11 04:51)

Follow Lexaloffle:        
Generated 2020-11-28 07:39 | 0.123s | 2097k | Q:96