Comments (5)
Thanks You !
from md_parola.
At the moment there is no way to do this. The sprite will be turned around by the library when the direction changes.
from md_parola.
I need a one more clarification, perhaps my question is not clear enough.
For the pacman1
, when it is running in real hardware it first running from left to right, and the pacman heading to right side.
I can accept it.
(my parola sprite editor always drawn the pacman as heading to left (it also "flipped") , that looks like it make my thinking as complicated. I am sorry for that.)
But after pacman reached the screen width, the pacman heading to left side; which is what I want to avoid.
So, do you think that the only solution is I should writing a brand new function ?
Would you like to give me some clues for doing that?
from md_parola.
Hi, finally I found a solution without need of additional function (can work with current MD_Parola).
Well, inspired by Parola_Animation_Catalog.ino
that show 2 different sprites for one animation, I created a flipped sprite to be shown as "not flipped" (because the second sprite will always flipped horizontally by library).
The idea is to provide 2 sprites, with the second one as flipped from first sprites
// Sprite Definition
const uint8_t F_ROCKET = 2;
const uint8_t W_ROCKET = 11;
const uint8_t PROGMEM rocket_launch[F_ROCKET * W_ROCKET] = // rocket
{
0x18, 0x24, 0x42, 0x81, 0x99, 0x18, 0x99, 0x18, 0xa5, 0x5a, 0x81,
0x18, 0x24, 0x42, 0x81, 0x18, 0x99, 0x18, 0x99, 0x24, 0x42, 0x99,
};
const uint8_t PROGMEM rocket_depart[F_ROCKET * W_ROCKET] = // rocket flipped no-flip
{
0x81, 0x5a, 0xa5, 0x18, 0x99, 0x18, 0x99, 0x81, 0x42, 0x24, 0x18,
0x99, 0x42, 0x24, 0x99, 0x18, 0x99, 0x18, 0x81, 0x42, 0x24, 0x18,
};
The full source-code below can be shown (as live / online simulation) here : https://wokwi.com/projects/346387200800195154
full code:
// Program to exercise the MD_Parola library
//
// Demonstrates an un-flpped sprite.
// a demo solution of question : https://github.com/MajicDesigns/MD_Parola/issues/102
//
// MD_MAX72XX library can be found at https://github.com/MajicDesigns/MD_MAX72XX
//
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
// Define the number of devices we have in the chain and the hardware interface
// NOTE: These pin numbers will probably not work with your hardware and may
// need to be adapted
#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW
#define MAX_DEVICES 11
#define CLK_PIN 13
#define DATA_PIN 11
#define CS_PIN 10
// HARDWARE SPI
MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
// SOFTWARE SPI
//MD_Parola P = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);
// Global variables
const char msg[] = "Parola Sprites";
// Sprite Definition
const uint8_t F_ROCKET = 2;
const uint8_t W_ROCKET = 11;
const uint8_t PROGMEM rocket_launch[F_ROCKET * W_ROCKET] = // rocket
{
0x18, 0x24, 0x42, 0x81, 0x99, 0x18, 0x99, 0x18, 0xa5, 0x5a, 0x81,
0x18, 0x24, 0x42, 0x81, 0x18, 0x99, 0x18, 0x99, 0x24, 0x42, 0x99,
};
const uint8_t PROGMEM rocket_depart[F_ROCKET * W_ROCKET] = // rocket flipped no-flip
{
0x81, 0x5a, 0xa5, 0x18, 0x99, 0x18, 0x99, 0x81, 0x42, 0x24, 0x18,
0x99, 0x42, 0x24, 0x99, 0x18, 0x99, 0x18, 0x81, 0x42, 0x24, 0x18,
};
void setup(void)
{
P.begin();
P.displayText(msg, PA_CENTER, P.getSpeed(), 1000, PA_SPRITE, PA_SPRITE);
P.setSpriteData(rocket_launch, W_ROCKET, F_ROCKET, rocket_depart, W_ROCKET, F_ROCKET);
}
void loop(void)
{
if (P.displayAnimate())
P.displayReset();
}
from md_parola.
from md_parola.
Related Issues (20)
- strrev missing?? HOT 7
- CP437 Font File HOT 1
- Scrolling text one time HOT 1
- Interrupt text effect in anytime HOT 3
- Use of MD_parola HOT 2
- [QUESTION] turn specific pixel on or off? HOT 2
- Remanant residual text on Double_Height on 2x19 matrix HOT 5
- How can I change HARDWARE_TYPE and MAX_DEVICES from the loop depending on some integer variables HOT 1
- Pixel errors and display reset HOT 1
- For UNO r4 minima is this lib ported ? or just works as it is HOT 1
- I want to use Hindi font. How can i use ? HOT 1
- Display Clear is not working HOT 2
- issue on P.displayAnimate() parola HOT 3
- avr/io.h HOT 1
- access the dot display buffer before animation ? HOT 4
- Software SPI not working on Arduino Nano ESP32 HOT 2
- Is there a way to access the framebuffer directly? HOT 1
- Show RtcDS3231.h time on Max7219 HOT 9
- Can't Grow Down A Font Character as One Character When Using 2 FC16 Modules HOT 8
- Combination of text scroll with bitmap sprite animation HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from md_parola.