Log In  

Care 4 Strays

Feed and cure our little wandering friends!

Disclaimer: Most of the Sprites/Code used are taken through tutorials, videos and lots of chatting/suggestion/debugging from fellow Pico8ers.
A big thank you to anyone involved!

ToDo

Code

  1. Win condition - end game
  2. Code cleanup/refactoring

Sprites

  1. Distinguish hungry from ill Cat sprites
  2. Create more flora sprites (grass, flowers, trees)

Map

  1. Revamp map
  2. Create more levels (seasonal)

Music & Sounds

  1. Create theme
  2. Sounds for Player interactions

Known Bugs

  1. Sometimes after Player movement, its sprite does not reset to default (no 10)
  2. Animated tiles epic cat bug (to be recorded)

v1.0 (initial commit):

Cart #care_for_strays_v1-0 | 2022-07-24 | Code ▽ | Embed ▽ | No License
1

v1.1:

Cart #care4strays_v1_1-0 | 2022-07-24 | Code ▽ | Embed ▽ | No License
1

Bugfixes

  1. Fixed Player's sprite movement - going diagonal is now very smooth
  2. Fixed a bug where colliding with a Food sprite gave a quantity of 3 Food on the Inventory
  3. Door is now opening correctly when Player has a Key and collides with it
  4. Food is now correctly swapping tiles when Player collides with it

Changelog

  1. Collision now happens through Player's feet
  2. Revamp map
  3. Added medicine, extra key and ill cat
  4. Added collision sound
P#114715 2022-07-24 07:57 ( Edited 2022-07-24 19:03)

Hello,

I am new to Pico-8 and this is my first try of creating a game.
Need a little help with understanding my errors.
Known bugs so far:

  1. south and east wall-sprites (stones,water) does not work as intended (player dives into them till their very last pixel row/column)
  2. sprite does not reset to no10 when player not moving
  3. cat and door tiles are not replaced when the requiremens are met, while food tile is replaced with a wrong tile
P#114717 2022-07-24 08:04 ( Edited 2022-07-24 08:07)

While skimming through I noticed that you typed

if not player.moving then
 player.srpite = 10
end

Obviously a typo, it should be player.sprite.

As for the cat and door, the relevant function declarations lack parameters, thus swap_tile() has no idea where to swap from. Instead of

function feed_cat()
 player.food -= 1
 swap_tile(x,y)
 -- sound effect
end

it should be

function feed_cat(x,y)
 player.food -= 1
 swap_tile(x,y)
 -- sound effect
end

You are already passing x and y as arguments when calling those functions inside of interact() so that fix will do the trick.

For the food tile swap bug, remember swap_tile() is currently set up so that the swapped out tile is replaced with the one to its right on the spritesheet.
To fix this, the simplest would be to modify your spritesheet so that a floor tile is to the right of each food item.
To be more efficient you would use variables to keep track of which ground sprite needs to be passed to mset, according to whether the food was picked up outside or inside.

P#114722 2022-07-24 08:42 ( Edited 2022-07-24 09:04)

For a first step you need to check the right and bottom of where the player is going to be.

This isn't perfect (gameplay wise) and it can be cleaner code but... This works.

function can_move(x,y)
    --player sprite is 8 chars
    local offset=1-(1/8)
    if is_tile(wall, x,y) then
        --collide on top left
        return false
    end
    if is_tile(wall, x+offset,y) then 
        --collide on top right
        return false
    end
    if is_tile(wall, x,y+offset) then
        --collide on bottom left
        return false
    end
    if is_tile(wall, x+offset,y+offset) then
        --collide on bottom right
        return false
    end
    return true
end```

See if you can undersand why that works.

Ideally you would have a collision box smaller than the sprite for gameplay)
P#114723 2022-07-24 08:45

@jneda lol, stupid me! It is still a little hard to keep track of my functions in such a small programming interface, I notice I do lots of those mistakes!. Thank you!
@SquidLight much appreciated again! :)

P#114726 2022-07-24 08:53 ( Edited 2022-07-24 08:53)

It happens to all of us.
I edited my message to suggest a solution about your tile swapping issues.
I laughed when I discovered cats turn into poop after you feed them. I'm a simple man of simple tastes.

P#114727 2022-07-24 09:06

Haha. ye me too (at least at these first levels) ^^
Just tried your game, can't get how to play though but I really like the graphics!
Thanks again :D

P#114728 2022-07-24 09:10 ( Edited 2022-07-24 09:12)

That's not a game, it's the pathfinding demo from Picozine issue #4.

P#114730 2022-07-24 09:30

Oh...still cool :P

P#114740 2022-07-24 10:11

[Please log in to post a comment]