Understanding the language, error messages, etc.
by Duhjoker » Mon Jul 04, 2016 6:48 am
Hi guys
I know how to use Arduino as far as flashing programs to boards and configuring and all that and I also have a some compiling skill in C++ but this is a completely new area for me.
I've been looking through the wiki and the looking at examples and watched the videos but I'm still a lil lost.
What I would like to do to start off is begin making my sprites and game maps. I understand how to make the Sprite using the binary method but I'm clueless as how to save that bit of code then encode it to .png for use with the game files.
can some one help me get to right info?
Any help will be appreciated
-
Duhjoker
-
- Posts: 446
- Joined: Sat Jul 02, 2016 4:57 am
- Location: Where Palm trees grow
by Sorunome » Mon Jul 04, 2016 7:33 am
You don't encode a sprite to png, you use the binary data and store it in the program memory, e.g.
- Code: Select all
const byte wall[] PROGMEM = {8,8,0xFB,0xFB,0x00,0xFE,0xFE,0x00,0xFB,0xFB};
and then you draw that with e.g.
- Code: Select all
gb.display.drawBitmap(drawX,drawY,wall);
-
Sorunome
-
- Posts: 629
- Joined: Sun Mar 01, 2015 1:58 pm
-
by Duhjoker » Mon Jul 04, 2016 8:23 pm
Edited: no useful content
Last edited by
Duhjoker on Tue Aug 02, 2016 11:22 pm, edited 1 time in total.
-
Duhjoker
-
- Posts: 446
- Joined: Sat Jul 02, 2016 4:57 am
- Location: Where Palm trees grow
by Duhjoker » Mon Jul 04, 2016 9:29 pm
ok I made myself a lil template and made sure it would compile. It does. I called rock in the program since im gonna try to make a rock image.
Do I n
- Code: Select all
//imports the SPI library (needed to communicate with Gamebuino's screen)
#include <SPI.h>
//imports the Gamebuino library
#include <Gamebuino.h>
//creates a Gamebuino object named gb
Gamebuino gb;
const byte PROGMEM turtle_rock[] =
{
16,16,
B00011110,B00000000,
B00101001,B10000000,
B01010000,B11111000,
B01010000,B10101100,
B10010000,B10100110,
B10000001,B01000011,
B10000001,B01010011,
B10000001,B01010011,
B01000001,B01010011,
B01000001,B01011011,
B01000001,B00001011,
B10000001,B00000101,
B10000000,B00000101,
B10000000,B11101100,
B01000001,B00111111,
B11111111,B11111000,
};
// the setup routine runs once when Gamebuino starts up
void setup(){
// initialize the Gamebuino object
gb.begin();
}
// the loop routine runs over and over again forever
void loop(){
//updates the gamebuino (the display, the sound, the auto backlight... everything)
//returns true when it's time to render a new frame (20 times/second)
if(gb.update()){
gb.display.drawBitmap(10,10,turtle_rock);
}
}
Do I need to put the placement coordinate in if its gonna be a general Sprite to use later on a map?
update:
Made template into turtle rock for myth of esmerelda LOZ port.
I would like to see what it looks like but I cant figure out how to make it export for use in the gamebuino emulator.
-
Duhjoker
-
- Posts: 446
- Joined: Sat Jul 02, 2016 4:57 am
- Location: Where Palm trees grow
by Sorunome » Tue Jul 05, 2016 8:19 am
Duhjoker wrote:Ok it would help if there was a reference. I've been trying to look at other peoples sprites but they are all in .png form.
Also I don't have a program yet to store it into. If I save it, it just saves it as a sketch.ino file.
They probably used a tool such as
this one to encode their sprites
Duhjoker wrote:
I would like to see what it looks like but I cant figure out how to make it export for use in the gamebuino emulator.
You need to get the eep file from the build directory, turn on verbose compiling in the arduino ide and you'll see where it is
By the way, you can find a lot of reference in the wiki
over here
-
Sorunome
-
- Posts: 629
- Joined: Sun Mar 01, 2015 1:58 pm
-
by Duhjoker » Tue Jul 05, 2016 8:35 am
edited: no relevant info
Last edited by
Duhjoker on Tue Aug 02, 2016 11:23 pm, edited 1 time in total.
-
Duhjoker
-
- Posts: 446
- Joined: Sat Jul 02, 2016 4:57 am
- Location: Where Palm trees grow
by Duhjoker » Tue Jul 05, 2016 8:40 am
Yes thank you I have been looking at the reference but I'm still learning what each actually does and how to use it.
I downloaded the bitmap encoder supplied with the software bits but it won't open either my .ino files or the .hex files that arduino exports
-
Duhjoker
-
- Posts: 446
- Joined: Sat Jul 02, 2016 4:57 am
- Location: Where Palm trees grow
by naed » Tue Jul 05, 2016 11:48 am
The bitmap encoder changes your sprite (that I normally save as a .jpeg) into code like this
- Code: Select all
const byte wall[] PROGMEM = {8,8,0xFB,0xFB,0x00,0xFE,0xFE,0x00,0xFB,0xFB};
This code can then be used with your Gamebuino to display sprites.
There's lots of information on the forum already about this, I started brand new to any coding at all and I am just about finished with my first game. It takes a lot of patience and a lot of looking up the answers to your questions.
As for the emulator I have to use the web based one as my pc seems not to work with the stand-alone version... This can be found here
http://simbuino4web.ppl-pilot.com
-
naed
-
- Posts: 140
- Joined: Tue May 31, 2016 3:18 pm
by Duhjoker » Tue Jul 05, 2016 8:40 pm
Edited ::: no relevant information
Last edited by
Duhjoker on Tue Aug 02, 2016 11:25 pm, edited 1 time in total.
-
Duhjoker
-
- Posts: 446
- Joined: Sat Jul 02, 2016 4:57 am
- Location: Where Palm trees grow
by Duhjoker » Tue Jul 05, 2016 11:45 pm
Edited ::: no relevant information
Last edited by
Duhjoker on Tue Aug 02, 2016 11:25 pm, edited 1 time in total.
-
Duhjoker
-
- Posts: 446
- Joined: Sat Jul 02, 2016 4:57 am
- Location: Where Palm trees grow
Return to Programming Questions
Who is online
Users browsing this forum: No registered users and 6 guests