I am currently trying an idea proposed by MLXXXp on the discord, basically I’m having a hard time following the complicated tutorials for pokitto, and I had a very easy time learning with the gamebuino tutorials, so why not combine them both?
essentially I’m going to be learning with the gamebuino tutorials with all of your help by you all hopefully being nice enough to translate the code into pokitto code.
this will hopefully also make it much easier to make some good easy to understand tutorials in the future, and others struggling with coding for pokitto can follow along with my posts and with all of your help.
Gamebuino tutorial to help translate
I’ll post in 3 parts and hopefully you all can translate in 3 parts so its broken down like the tutorial is, and any explanations would be greatly appreciated, here goes.
part 1 = learning to display text from a variable
#include <Gamebuino-Meta.h>
int counter = 0; // New line
void setup() {
gb.begin();
}
void loop() {
while (!gb.update());
gb.display.clear();
gb.display.print(counter); // Something changed here :)
}
part 2 learning to play a basic sound, if statements and getting button input, also slowly moving a rectangle across the screen everytime a button is pressed and adding 1 each time.
void setup() {
gb.begin();
}
void loop() {
while (!gb.update());
gb.display.clear();
if (gb.buttons.pressed(BUTTON_UP)) { // If we press UP
counter = counter + 1; // Add 1 to "counter"
gb.sound.playTick(); // Play a ticking sound
} // End of IF
gb.display.print(counter);
gb.display.fillRect(counter, 8, 2, 4); // Draw the rectangle
}
part 3 up down, reset buttons to increment the number, connecting score to the size of the rectangle drawn so it gets bigger, aswell as making coordinates for them, and changing the rectangle colour, and number size
#include <Gamebuino-Meta.h>
int counter = 0;
void setup() {
gb.begin();
}
void loop() {
while (!gb.update());
gb.display.clear();
if(gb.buttons.pressed(BUTTON_UP)){
counter = counter + 1;
gb.sound.playOK();
}
if(gb.buttons.pressed(BUTTON_DOWN)){
counter = counter - 1;
gb.sound.playCancel();
}
if(gb.buttons.pressed(BUTTON_MENU)){
counter = 0;
gb.sound.playTick();
}
gb.display.setColor(BROWN);
gb.display.fillRect(0, 0, counter, gb.display.height());
gb.display.setColor(WHITE);
gb.display.setFontSize(4);
gb.display.setCursor(8,8);
gb.display.print(counter);
}
added my own explanation there for anyone who needed it and may not understand gamebuino code at all (i know a tiny bit)
so if anyone could translate these with an equivelant or more indepth explanation i’m sure us beginners would greatly appreciate it.