So i’m making a game where it uses @Craits tutorial to display an map. but all i get is gobble on screen instead of a map. just a bunch of “@$#@#” and other symbols
Have you lifter his code exactly or have you made changes. It might pay to publish the code so people can inspect it for you …
i will make a github link
To use drawBitmap(), your data has to be placed in program memory, using the PROGMEM attribute.
@MLXXXp was right, your tiles aren’t in progmem.
I made a PR that fixes the problem:
You can choose to merge it or close it and add the change yourself since it’s such a simple change.
If you aren’t used to Github yet, you can see the exact change here:
You shouldn’t use
TILE_SIZE because you din’t define it yet…
Use numbers to define the width and height of the sprite you want to draw.
I don’t think the bitmap for your sprite is proper…make sure it is the right one
Store them in
PROGMEM by adding it in front off the variables after making them
This applies to anything that is not changing when you run the code.
You are currently not using your
int Map, I see. But since you are not using all 2147483647 values, choose a smaller datatype can save you PROGMEM. (you shouldn’t pay attention beside change the
So you saying that the nonsense was because he didn’t put it in PROGMEM?
so to use
drawBitMap it MUST be stored in PROGMEM? (okay, but putting them in RAM will not work, especially for something I am working on…)
Arduboy2::drawBitmap requires bitmaps to be in progmem, as stated in the documentation.
Likewise, all the functions in the
Sprites class expect thier images to be in progmem.
It doesn’t really make sense to store images in RAM unless they’re going to change
(by which I mean the image data changing, not having different frames of an animation).
The only time I’ve known someone to write a function that draws bitmap in RAM was @filmote when he was trialling some sprite rotating code,
and technically it could have been rotated without storing the image in RAM,
it was just easier to copy it to RAM first.
int only stores 65536 values on the Arduboy (and other AVR chips).
int is 16 bits on the Arduboy and
pow(2, 16) is
Thanks! this community is AWSOME
Don’t forget to press the big green ‘Merge’ button if you want to merge the changes.
Otherwise if you want to dismiss the PR and add the changes yourself, there should be a ‘Close Pull Request’ button near the bottom of the page.
Will do that later on today when I have time. Heading out soon.