Help with Sprites?

Are you using windows, mac or linux?

Windows 10 (extra words)

Turns out they deprecated paint in the ‘Fall Creators Update’ ; n ;
That means it should still be there but they’re going to kill it someday.

You should be able to find paint using the search tool.
Otherwise look in your start menu under ‘W’ and there should be a ‘Windows Accessories’ folder and ‘Paint’ should be in there.

If not, Paint 3D (the paint replacement for Win 10) should be able to do .png files, but might not be as convinient for sprites.

Failing that there are some online spriting tools you could use, or you could look for other programs like paint.net (or the earlier mentioned GIMP).

1 Like

Might also want to look at graphicsgale, which is also free.

2 Likes

Ok so I have lots 0x00 and need some code to show them on my arduboy.
Can someone please make some code to make the 0x00 appear e.g.

#include arduboy stuff
// put your 0x00 here
show sprite
more stuff to make it work
more code

Thanks

Either:

#include <Arduboy2.h>

const uint8_t YourSprite[] PROGMEM =
{
	0x00, 0x00, 0x00, 0x00,
};

Arduboy2 arduboy;

void setup(void)
{
	arduboy.begin();
}

void loop(void)
{
	if(!arduboy.nextFrame())
		return;
		
	arduboy.clear();
	arduboy.drawBitmap(0, 0, YourSprite, widthOfYourSprite, heightOfYourSprite);
	arduboy.display();
}

Or:

#include <Arduboy2.h>

const uint8_t YourSprite[] PROGMEM =
{
	widthOfYourSprite, heightOfYourSprite,
	0x00, 0x00, 0x00, 0x00,
};

Arduboy2 arduboy;

void setup(void)
{
	arduboy.begin();
}

void loop(void)
{
	if(!arduboy.nextFrame())
		return;
		
	arduboy.clear();
	Sprites::drawOverwrite(0, 0, YourSprite, 0);
	arduboy.display();
}

And you have to replace widthOfYourSprite and heightOfYourSprite with the width and height of your sprite.

If the sprite is fullscreen then that’s 128x64.

1 Like

Ahh you beat me to it.

#include <Arduboy2.h>

Arduboy2 arduboy;

const uint8_t Rabbit[] PROGMEM = {

  8, 8,
  
  0x00, 0x78, 0x7E, 0x78, 0x78, 0x7E, 0x78, 0x00,
};


const uint8_t Rabbits[] PROGMEM = {

  8, 8,
  
  // Frame 0 (North)
  0x00, 0x78, 0x7E, 0x78, 0x78, 0x7E, 0x78, 0x00,
  
  // Frame 1 (East)
  0x00, 0x00, 0x78, 0x7E, 0x48, 0x78, 0x00, 0x00,
  
  // Frame 2 (South)
  0x00, 0x78, 0x4E, 0x78, 0x78, 0x4E, 0x78, 0x00,
  
  // Frame 3 (West)
  0x00, 0x00, 0x78, 0x48, 0x7E, 0x78, 0x00, 0x00,
};


uint8_t frame = 0;

void setup() {

  // initiate arduboy instance
  arduboy.begin();

  // here we set the framerate to 15, we do not need to run at
  // default 60 and it saves us battery life
  arduboy.setFrameRate(5);
  
}


// our main game loop, this runs once every cycle/frame.
// this is where our game logic goes.
void loop() {
  // pause render until it's time for the next frame
  if (!(arduboy.nextFrame()))
    return;

  // first we clear our screen to black
  arduboy.clear();


  frame++;
  if (frame == 4) frame = 0;

  Sprites::drawOverwrite(16, 16, Rabbit, 0);
  Sprites::drawOverwrite(96, 16, Rabbits, frame);


  // then we finaly we tell the arduboy to display what we just wrote to the display
  arduboy.display();
}
2 Likes

Do you mean top to bottom, white pixels, side to side white pixels?

and I get this error

Arduino: 1.8.5 (Windows Store 1.8.10.0) (Windows 10), Board: “Arduino Leonardo”

In function ‘void loop()’:

error: ‘class Arduboy2’ has no member named ‘draw’

arduboy.draw(0, 0, Guy, 128, 64);

       ^

exit status 1
‘class Arduboy2’ has no member named ‘draw’

This report would have more information with
“Show verbose output during compilation”
option enabled in File -> Preferences.

All pixels in total.
The entire width of the sprite and the entire height of the sprite.

Sorry, just fixed that.
I accidentally wrote draw instead of drawBitmap.

I tend to use the Sprites functions for drawing rather than the regular Arduboy2 drawing functions.


By the way, @filmote’s version has comments which I didn’t bother to add, and he uses a slightly more complex feature, so be sure to read his too.

(Also he borrowed the Rabbit sprites from my game jam entry EasterPanic, so that nets bonus points :P.)

now this
Arduino: 1.8.5 (Windows Store 1.8.10.0) (Windows 10), Board: “Arduino Leonardo”

Sketch uses 8394 bytes (29%) of program storage space. Maximum is 28672 bytes.
Global variables use 1224 bytes (47%) of dynamic memory, leaving 1336 bytes for local variables. Maximum is 2560 bytes.
processing.app.debug.RunnerException
at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:160)
at cc.arduino.UploaderUtils.upload(UploaderUtils.java:78)
at processing.app.SketchController.upload(SketchController.java:713)
at processing.app.SketchController.exportApplet(SketchController.java:686)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2168)
at java.lang.Thread.run(Thread.java:748)
Caused by: processing.app.SerialException: Error touching serial port ‘COM3’.
at processing.app.Serial.touchForCDCReset(Serial.java:107)
at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:144)
… 5 more
Caused by: jssc.SerialPortException: Port name - COM3; Method name - openPort(); Exception type - Port busy.
at jssc.SerialPort.openPort(SerialPort.java:164)
at processing.app.Serial.touchForCDCReset(Serial.java:101)
… 6 more
An error occurred while uploading the sketch
Exception in thread “Thread-57” java.util.ConcurrentModificationException
at java.util.LinkedList$LLSpliterator.forEachRemaining(LinkedList.java:1239)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
at cc.arduino.contributions.libraries.LibrariesIndexer.rescanLibraries(LibrariesIndexer.java:127)
at cc.arduino.contributions.libraries.LibrariesIndexer.setLibrariesFolders(LibrariesIndexer.java:106)
at processing.app.BaseNoGui.onBoardOrPortChange(BaseNoGui.java:682)
at processing.app.Base.onBoardOrPortChange(Base.java:1313)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2198)
at java.lang.Thread.run(Thread.java:748)

This report would have more information with
“Show verbose output during compilation”
option enabled in File -> Preferences.

… which might look suspiciously like the ones from ‘HelloWorld’

2 Likes

My bad it was bricked from Trolly Fish and yay it worked. :smiley:

There is a bug in the Arduino IDE where if an upload fails then the next upload will fail with an error message regardless of if the game works.

No idea why it happens, but I think that’s what happened there beacuase it compiled properly and then failed with a ‘RunnerException’.

1 Like

Is there a place where I can put 0x00 and edit it?

Emuty’s tool has an upload feature using the ‘Browse…’ button.

Where is upload? #####

Do I upload a .txt file?

I would presume it loads data in the same format it gives it out in.