quantum-fringe-entertainment / raylib-super-mario-clone Goto Github PK
View Code? Open in Web Editor NEWSuper mario clone made using raylib 3.0
License: MIT License
Super mario clone made using raylib 3.0
License: MIT License
Issue :
DrawTextureRec()
that Rectanlge cannot be used for collision detection.Proposed Solution :
Implementation Code :
void AnimateSpriteSheetRec(Texture2D spriteSheet, Rectangle *frameRec, int framesSpeed, int frames){
static float framesCounter = 0;
static int currentFrame = 0;
*frameRec = (Rectangle){ 0.0f, 0.0f, (float)spriteSheet.width/frames, (float)spriteSheet.height };
framesCounter += GetFrameTime();
if (framesCounter >= (float)framesSpeed/100)
{
framesCounter = 0;
currentFrame++;
if (currentFrame > frames - 1) currentFrame = 0;
}
frameRec->x = (float)currentFrame*(float)spriteSheet.width/frames;
}
Issue :
This function uses Static variables for frameRateCounter and currentFrame counting which makes this is ideal if is being used to animate a single sprite sheet with the intention of avoiding global variables, but the static variables values get overwritten/ influenced if the function is called multiple times to animate other sprites sheets/ Different Textures making this function Non-Generic, also using global variables for frame and rate counting for 100's of sprites sheets would be absurd.
Desired Solution:
It is necessary to make this function more Generic by making it retain certain values (for now 2 variables for rate and frameCount) separately for each instance call if new Texture is passed to is. So for every new texture how many ever times it may be called it must retain a few variables, i.e must have local static variables for every new texture passed.
Current Workaround:
Issue :
The state machine which controls the Animations and Movement of the player does not allow multiple states to work simultaneously. Player cannot Jump from Walking state and cannot move while in midair i.e. while in Jumping state.
Desired Solution :
Proper state transition paths and rules must be programmed with the state machine.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.