Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Pixel manipulating

A topic by OsmineeNitro created May 04, 2020 Views: 346 Replies: 12
Viewing posts 1 to 4
Submitted

Can you manipulate with pixels to make for example 1x1 orange pixel as sprite?

Submitted

Which platform? Pico-8? Tic-80? Something else?

I was searching for a similar thing for Tic-80 and found these, but I haven’t tried it yet:

https://github.com/nesbox/TIC-80/wiki/code-examples-and-snippets#setget-spritesheet-pixel

https://github.com/nesbox/TIC-80/wiki/spr (first code example starting with -- spr demo

Submitted

Yeah, I work on  TIC-80, so thanks!

Submitted

You’re welcome!

But I don’t see an advantage to using a sprite for one pixel. I’m thinking you have x & y variables, so if you’re drawing the screen every TIC() I think you’d clear the screen and redraw everything. So draw whatever the pixel might collide with first, then use pix to read the color of where the pixel will be, and if it’s the color of the colliding object then you have a collision. Otherwise, use pix again to write the pixel orange or whatever.

I haven’t programmed a line of Tic-80 code yet, though…I’m just getting this from reading Itch and the Tic-80 wiki.

Submitted

Hey, wanna team up? (if allowed)

Submitted

This is my first Jam and first time trying Tic-80, so I want to try to figure it all out myself for now.

Submitted

Ok, but if you want help, ask me or someone else (or just look into TIC-80 documentation ;) )

HostSubmitted(+2)

Hi OsmineeNitro! I'm not sure what the syntax is in TIC-80, but in PICO-8, you can skip the spritesheet altogether and use pset(x,y,c) to set a single pixel on the screen at x,y at the color c. The jam doesn't allow sprites, but you can use any character glyphs allowed within your engine.

Submitted

Ok, but I can instead use pixels as character, right?

Submitted (1 edit) (+1)

The jam doesn’t allow sprites,

Oh? I thought it was external sprites. If you poke a sprite in from the 560 chars of code is it still not allowed?

I don’t even know yet if that’s plausible to do in 560 chars, but I was going to try it at least once. I was going to try OP’s 1-pixel sprite example then realized there’s no advantage to doing so for a single pixel in Tic-80.

Submitted

Idk if you can do 1-pixel sprite from TIC-80 code, but instead you can color 1 pixel and update it's position when key is pressed.

Submitted (1 edit)

Here is a poked 1-pixel sprite for TIC-80. I think it’s pointless, but poking in a more complex sprite might be doable.

I just wanted to try it out and provide a working example.

-- Fill a sprite with zeroes
for i = 0,31 do
    poke(0x4000+i, 0)
end
-- Poke a palette 9 pixel in the sprite
poke4(0x8000, 9)
x=50
y=50

function TIC()
    y=y+1
    x=x+1
    cls()
    -- Sprite with 0 as transparent
    spr(0,x%240,y%136,0)
    print("Poked sprite")
end
HostSubmitted(+1)

Hey Jim! Yes, you're right about that. We don't allow spritesheets in the traditional sense, but if you can poke in some sprite art from the code, that's just fine! :)