Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Pixel chaser game
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Pixel chaser game

by Freeheeler19 on Mon Jan 13, 2020 6:43 pm

Hi,
Im trying to make this game https://youtu.be/hjqtJA7gVQ0 on a 8x8 neopixel matrix.
Have been trying to adapt the sketch but somehow that doesnt work.
Im still very new to coding, so maybe this is a bit too advanced for me.
Anyway, i think i learn a lot looking at and comparing sketches, while trying to understand what they actually do.
So really, any help is much appreciated.
How would a sketch for a game like this look like on a 8x8 matrix? Thinking of only using the edge leds....( all around =circle)
Thanks a lot for your inputs.

Regads cyril

Freeheeler19
 
Posts: 16
Joined: Tue Dec 17, 2019 12:19 pm

Re: Pixel chaser game

by dastels on Mon Jan 13, 2020 7:02 pm

The biggest change will be to setting pixel colors. Where Seon uses pixels.setPixelColor, you'll need to set the appropriate NeoTrellis pixel. Probably what I'd do (evening project?) is write a function that takes a position on a virtual 28-pixel ring and a color and converts that to the appropriate pixel around the edge of the NeoTrellis.

Dave

dastels
 
Posts: 3519
Joined: Tue Oct 20, 2015 3:22 pm

Re: Pixel chaser game

by Freeheeler19 on Tue Jan 14, 2020 3:10 am

Hi,
Thanks for your answer.
I really would like to do this the exact same way as described in the youtube link above. Just would like to adapt the code to a 8x8 matrix. Because i would like to work with matrices. And not with a neotrellis. (For the time at least. )
Just wonder how you could make only the edge leds shine and then of course get them moving around.....
Any advise is appreciated. Thanks a lot

Cyril

Freeheeler19
 
Posts: 16
Joined: Tue Dec 17, 2019 12:19 pm

Re: Pixel chaser game

by dastels on Tue Jan 14, 2020 10:05 am

Ah. Part of the 8x8 NeoTrellis is just an 8x8 NeoPixel matrix. That's how I'm using it for this since I don't have a standalone 8x8 matrix. As I said, a function that takes an index around the "ring" and a color and sets the appropriate pixel along the edge of the matrix is the only real change. You just need to call that function in place of pixels.setPixelColor. You also need to change the code that sets up the pixels appropriately. Other than that the existing code is pretty much fine as is.

Dave

dastels
 
Posts: 3519
Joined: Tue Oct 20, 2015 3:22 pm

Re: Pixel chaser game

by kcl1s on Tue Jan 14, 2020 10:38 am

I would make an array of the perimeter pixels and have the game reference the array member. I would not use the Neomatrix library and just locate the pixels around the perimeter. Your array might look like this. int perimeterPix[] = {0,1,2,3,4,5,6,7,15,23,31,39,47,55,63,62,61,60,59,58,57,56,48,40,32,24,16,8} Then in the code anywhere you have a setPixelColor command like this pixels.setPixelColor(i, pixels.Color(255,155,0)); replace the i with perimeterPix[i] like this pixels.setPixelColor(perimeterPix[i], pixels.Color(255,155,0)); Also anywhere in the for loops you see NUMPIXELS you will have to change it to 28.

Hope this helps.

Fellow hobbyist
Keith

kcl1s
 
Posts: 1511
Joined: Tue Aug 30, 2016 12:06 pm

Re: Pixel chaser game

by Freeheeler19 on Wed Jan 15, 2020 3:21 pm

Cool. Thank you both for the replies. I think that helps. Will let you know.
I actually already started with an array of the respective pixels that i took from another sketch.
Thanks For the pixels.setPixelColor(perimeterPix[i] hint.

Freeheeler19
 
Posts: 16
Joined: Tue Dec 17, 2019 12:19 pm

Please be positive and constructive with your questions and comments.