Eating the many, many little Pacman pills

Started by bx83, Tue 13/07/2021 13:37:00

Previous topic - Next topic

bx83

I'm making a Pacman clone.
In it, I want to have unexplored maze be filled with a little circular pill that my main character can eat up. There are 40 objects allowed on screen; no idea how many characters, but probably not 20 I have +200 little pills.
Does anyone have any idea how to solve this problem? How can I get the little round pills in all free squares and then get them to change graphic or destroy() when my Character collides with them?


Crimson Wizard

#1
Simple solution is to draw them on a room background and then paint them over as pacman eats them.

If your game is tile-based, you may even store these pills as an array of bools the size of map.

Quote from: bx83 on Tue 13/07/2021 13:37:00There are 40 objects allowed on screen; no idea how many characters, but probably not 20

Characters are unlimited, it's just that having objects or character for that lots of tiny items is very non-optimal.

Khris

Yeah, the answer to this is the same as here:

https://www.adventuregamestudio.co.uk/forums/index.php?topic=59256.msg636637423#msg636637423

I didn't elaborate but the basic idea is to have a suitable data structure and just draw it to the screen 40 times per second.

bx83

CW: But how would he paint them over? DrawCircle(black); ds.Release(); somehow get all characters to move over the Circles? Ah I'm sure it's possible, will investigate...
Khris: which answer, the grid? Already got that semi-programmed...

Crimson Wizard

#4
Quote from: Khris on Tue 13/07/2021 13:58:58and just draw it to the screen 40 times per second.

You do not really have to redraw it every frame; for instance if the moving creatures are objects or characters, then you could just draw on background once and only edit it as something changes.

EDIT: oh, I read the previous conversation. Your game does not have the actual "pills", but other moving objects?

bx83

Yes - crowds are Objects, tank is Character.

SMF spam blocked by CleanTalk