Chara pixelcroft in the shrine of dusty artifacts

You must put some step-by-step game guide for amateurs and game programming learners for step-by-step game development, so that anyone who is interested to build game from scratch will know how to do it actually :clap:

sure thing but it hard to explain what exactly im doing, botching allot of weird stuff together

1 Like

looking for collaboration on the side scroller platformer engine.
would be used for this game and any others making it easer for more platformer games to be made

pm me for interest

I might be interested! I sent a pm with more details.

Wish I could code and I’d help.

wish no more, just do it :stuck_out_tongue:

1 Like

Cool , that will be my next project, currently working on a wooden Alexa just waiting on a few parts to arrive wire it up see if it works then build the case

need some help with collision + physics
for platfrormer
code so far works on hardware

#include "Pokitto.h"
#include "sprites.h"
Pokitto::Core game;
bool checkcheck(short x, short y,short w, short h){
    short t =((short)(-y+w)/16)*8 +(short)((short)((-x+h)/16)/2);
    if(((short)((-x+h)/16))%2 ==1){
        if(level[t+3]>>4 == 15) return 0;
    }
    else{
       if(((uint8_t)(level[t+2]<<4))>>4 == 15)  return 0;
    }
    return 1;
}
bool collcheck(short x, short y){
    if(checkcheck(-x,-y,55,59)){
        return 0;
    }
    if(checkcheck(-x,-y,55,49)){
        return 0;
    }
    if(checkcheck(-x,-y,39,59)){
        return 0;
    }
    if(checkcheck(-x,-y,39,49)){
        return 0;
    }
    if(checkcheck(-x,-y,33,59)){
        return 0;
    }
    if(checkcheck(-x,-y,33,49)){
        return 0;
    }
    return 1;
}
void DrawLevel(short x, short y){
   game.display.drawRectangle((short)((-x+59)/16)*16+x,((short)(-y+55)/16)*16+y,16,16);
   game.display.drawRectangle((short)((-x+49)/16)*16+x,((short)(-y+55)/16)*16+y,16,16);
   game.display.drawRectangle((short)((-x+59)/16)*16+x,((short)(-y+39)/16)*16+y,16,16);
   game.display.drawRectangle((short)((-x+49)/16)*16+x,((short)(-y+39)/16)*16+y,16,16);
   game.display.drawRectangle((short)((-x+59)/16)*16+x,((short)(-y+33)/16)*16+y,16,16);
   game.display.drawRectangle((short)((-x+49)/16)*16+x,((short)(-y+33)/16)*16+y,16,16);
    char width = level[0];
    char w2 = width/2;
    char tileSize = 16;
    char ts2 = tileSize*2;
    for(int i = 0; i < width*(level[1]/2); i++){
        if ((level[i+2]>>4) <2){
            game.display.drawBitmap(((i%w2)*ts2)-tileSize+x,(((int)i/w2)*tileSize)+y,rock[(level[i+2]>>4)]);
        }
        if (((uint8_t)(level[i+2]<<4))>>4 <2){
            game.display.drawBitmap(((i%w2)*ts2)+x,(((int)i/w2)*tileSize)+y,rock[((uint8_t)(level[i+2]<<4))>>4]);
        }
    }
}

int main () {
game.begin();
game.display.bgcolor=11;
short x = 50;
short y = 184;
float vy = 0;
char frame = 0;
short speed = 4;
float maxspeed = 6;

short gravity = 0;
bool floor = true;

bool derection = false;
game.display.load565Palette(pallet);
while (game.isRunning()) {

     if (game.buttons.pressed(BTN_A) && collcheck(x,y-(30/5))==1 && floor){
            vy=30;
            floor = false;
    }

    if (game.update()) {

        if(vy > 0){
            if (collcheck(x,y-(vy/5))==1){
                y-=vy/5;
                vy-=2;
            }else vy=0;
        }
        else if(y < 184){
            bool looptest = true;
            while(looptest){
                if (collcheck(x,y+gravity)==1){
                    y+=gravity;
                    gravity++;
                    looptest = false;
                }
                else if(gravity>1){
                    gravity-=1;
                }
                else{
                    floor = true;
                    looptest = false;
                }
            }
        }
        if(collcheck(x,y+gravity)==0){floor = true;}

         if (game.buttons.repeat(BTN_LEFT,0)){
            bool looptest = true;
            while(looptest){
                if (collcheck(x-speed,y)==1){
                    x-=speed;
                    looptest = false;
                }else{
                    speed --;
                }
            }
            speed = 4;
            derection = false;
            //if(x%4==0){
            frame++;
            frame=frame%6;
            //}
        }
        else if (game.buttons.repeat(BTN_RIGHT,0)){
            bool looptest = true;
            while(looptest){
                if (collcheck(x+speed,y)==1){
                    x+=speed;

                 looptest = false;
                }else{
                    speed --;
                }
            }
            derection = true;
            //if(x%4==0){
            frame++;
            frame=frame%6;
           // }
        } else frame = 0;


        DrawLevel(-x,-y);
        game.display.setInvisibleColor(14);
        game.display.drawBitmap(55-7,44-13,sprite[frame],0,derection);
        game.display.bgcolor =2;
        game.display.print("hi");
    }

}

return 1;
}


sprites.h

//sprite
const unsigned short pallet[]={
0xb07,
0x44a,
0x6506,
0x8668,
0x0,
0x210,
0x4439,
0x7ddf,
0x72c7,
0xcc68,
0xfeb2,
0xfd42,
0xf720,
0xacd0,
0xca30,
0xffff,
};

//sprite
const uint8_t sprite[][366]={{14, 26, /*width, height*/
0xee,0xee,0xe8,0x88,0x88,0xee,0xee,
0xee,0xee,0x8d,0xd8,0xdd,0x8e,0xee,
0xee,0xe8,0x88,0x88,0x88,0xd8,0xee,
0xee,0x8d,0xcc,0xbb,0x8d,0xc8,0xee,
0xee,0xd8,0xaa,0xa9,0x8d,0x88,0xee,
0xee,0x84,0x4a,0x44,0x88,0xd8,0xee,
0xee,0xd8,0x5a,0x5f,0x88,0xd8,0xee,
0xee,0xe8,0x4a,0x4f,0xa8,0x88,0xee,
0xee,0xe8,0xaa,0xaa,0x98,0x8e,0x8e,
0xee,0x8e,0xe1,0xa9,0x1e,0x8e,0xee,
0xee,0xea,0xa1,0x31,0x3a,0xa8,0xee,
0xee,0xe9,0x33,0x33,0x39,0xae,0xee,
0xee,0xee,0x33,0x33,0x10,0xaa,0xee,
0xee,0xee,0xa3,0x31,0x0e,0x9a,0xee,
0xee,0xea,0x91,0x11,0x0e,0xea,0xae,
0xee,0xe9,0xac,0xb4,0x4e,0xe9,0xae,
0xee,0xee,0x48,0x48,0x84,0x9a,0xae,
0xee,0xee,0x48,0x44,0x84,0xea,0x9e,
0xee,0xee,0x88,0x84,0x88,0xee,0xee,
0xee,0xee,0xaa,0x9a,0xaa,0xee,0xee,
0xee,0xee,0xaa,0x9a,0xaa,0xee,0xee,
0xee,0xee,0x99,0xae,0xa9,0x9e,0xee,
0xee,0xee,0xaa,0xae,0xaa,0xae,0xee,
0xee,0xee,0x44,0xae,0xa4,0x4e,0xee,
0xee,0xee,0x44,0x4e,0x44,0x4e,0xee,
0xee,0xe8,0x88,0x4e,0x48,0x8e,0xee,
},
{14, 26, /*width, height*/
0xee,0xee,0xe8,0x88,0x88,0xee,0xee,
0xee,0xee,0x8d,0xd8,0xdd,0x8e,0xee,
0xee,0xe8,0x88,0x88,0x88,0xd8,0xee,
0xee,0x8d,0xcc,0xbb,0x8d,0xc8,0xee,
0xee,0xd8,0xaa,0xa9,0x8d,0x88,0xee,
0xee,0x84,0x4a,0x44,0x88,0xd8,0xee,
0xee,0xd8,0x5a,0x5f,0x88,0xd8,0xee,
0xee,0xe8,0x4a,0x4f,0xa8,0x88,0xee,
0xee,0xe8,0xaa,0xaa,0x98,0x8e,0x8e,
0xee,0x8e,0xe1,0xa9,0x1e,0x8e,0xee,
0xee,0xea,0xa1,0x33,0x1e,0xe8,0xee,
0xae,0xea,0x93,0x33,0x31,0xee,0xee,
0x9a,0xe9,0x33,0x33,0x3a,0xae,0xee,
0xaa,0xaa,0x33,0x33,0x19,0xaa,0xee,
0xe9,0xaa,0xe1,0x11,0x0e,0x9a,0xae,
0xee,0xee,0xe1,0x11,0x0e,0xe9,0x9a,
0xee,0xee,0xec,0xb4,0x44,0xee,0x9a,
0xee,0xee,0x44,0x88,0x84,0xee,0xee,
0xee,0xee,0x48,0xaa,0x84,0xee,0xee,
0xee,0xee,0x8a,0xaa,0x98,0xee,0xee,
0xee,0xee,0x9a,0xa9,0xee,0xee,0xee,
0xee,0xee,0xea,0xa9,0xae,0xee,0xee,
0xee,0xee,0xe4,0x44,0xae,0xee,0xee,
0xee,0xee,0xe4,0x44,0x44,0xee,0xee,
0xee,0xee,0xe8,0x84,0x44,0xee,0xee,
0xee,0xee,0xee,0xe8,0x88,0xee,0xee,
},
{14, 26, /*width, height*/
0xee,0xee,0xee,0xee,0xee,0xee,0xee,
0xee,0xee,0xe8,0x88,0x88,0xee,0xee,
0xee,0xee,0x8d,0xd8,0xdd,0x8e,0xee,
0xee,0xe8,0x88,0x88,0x88,0xd8,0xee,
0xee,0x8d,0xcc,0xbb,0x8d,0xc8,0xee,
0xee,0xd8,0xaa,0xa9,0x8d,0x88,0xee,
0xee,0x84,0x4a,0x44,0x88,0xd8,0xee,
0xee,0xd8,0x5a,0x5f,0x88,0xd8,0xee,
0xee,0xe8,0x4a,0x4f,0xa8,0x88,0x8e,
0xee,0x88,0xaa,0xaa,0x98,0x8e,0xee,
0xee,0xee,0xe1,0xa9,0x1e,0x88,0xee,
0xea,0xa9,0x91,0x31,0x3a,0xaa,0xee,
0xea,0x9a,0x33,0x33,0x39,0xaa,0xae,
0xea,0x9a,0x33,0x33,0x10,0xe9,0xae,
0xe9,0xa9,0xe3,0x31,0x0e,0xee,0xaa,
0xee,0xee,0xe1,0x11,0x0e,0xee,0x9a,
0xee,0xee,0xec,0xb4,0x4e,0xee,0xee,
0xee,0xee,0x48,0x48,0x84,0xee,0xee,
0xee,0xee,0x48,0x8a,0x84,0xee,0xee,
0xee,0xee,0x49,0x9a,0x94,0xee,0xee,
0xee,0xee,0xe9,0xaa,0x9e,0xee,0xee,
0xee,0xee,0xea,0xa9,0xaa,0xee,0xee,
0xee,0xee,0x4a,0x9e,0x9a,0xae,0xee,
0xee,0xe4,0x44,0xee,0xe4,0x44,0xee,
0xee,0x84,0x44,0xee,0xee,0x44,0x4e,
0xee,0xe8,0x8e,0xee,0xee,0x88,0x8e,
},
{14, 26, /*width, height*/
0xee,0xee,0xee,0xee,0xee,0xee,0xee,
0xee,0xee,0xe8,0x88,0x88,0xee,0xee,
0xee,0xee,0x8d,0xd8,0xdd,0x8e,0xee,
0xee,0xe8,0x88,0x88,0x88,0xd8,0xee,
0xee,0x8d,0xcc,0xbb,0x8d,0xc8,0xee,
0xee,0xd8,0xaa,0xa9,0x8d,0x88,0xee,
0xee,0x84,0x4a,0x44,0x88,0xd8,0xee,
0xee,0xd8,0x5a,0x5f,0x88,0xd8,0xee,
0xee,0xe8,0x4a,0x4f,0xa8,0x88,0xee,
0xee,0xe8,0xaa,0xaa,0x98,0x8e,0x8e,
0xee,0x8a,0x91,0xa9,0x1a,0x8e,0xee,
0xee,0xe9,0x33,0x33,0x39,0xa8,0xee,
0xee,0xee,0x33,0x33,0x10,0xaa,0xee,
0xee,0xee,0xa3,0x31,0x0e,0x9a,0xee,
0xee,0xea,0x91,0x11,0x0e,0xea,0xae,
0xee,0xe9,0xac,0xb4,0x4e,0xe9,0xae,
0xee,0xee,0x48,0x48,0x84,0x9a,0xae,
0xee,0xee,0x48,0x44,0x84,0xea,0x9e,
0xee,0xee,0x88,0x84,0x88,0xee,0xee,
0xee,0xee,0xaa,0x9a,0xaa,0xee,0xee,
0xee,0xee,0xaa,0x9a,0xaa,0xee,0xee,
0xee,0xee,0xaa,0x99,0x9a,0xee,0xee,
0xee,0xee,0xe9,0x9a,0xaa,0x8e,0xee,
0xee,0xee,0xee,0x94,0x4a,0x8e,0xee,
0xee,0xee,0xee,0xe4,0x44,0x8e,0xee,
0xee,0xee,0xee,0x88,0x88,0xee,0xee,
},
{14, 26, /*width, height*/
0xee,0xee,0xe8,0x88,0x88,0xee,0xee,
0xee,0xee,0x8d,0xd8,0xdd,0x8e,0xee,
0xee,0xe8,0x88,0x88,0x88,0xd8,0xee,
0xee,0x8d,0xcc,0xbb,0x8d,0xc8,0xee,
0xee,0xd8,0xaa,0xa9,0x8d,0x88,0xee,
0xee,0x84,0x4a,0x44,0x88,0xd8,0xee,
0xee,0xd8,0x5a,0x5f,0x88,0xd8,0xee,
0xee,0xe8,0x4a,0x4f,0xa8,0x88,0xee,
0xee,0xe8,0xaa,0xaa,0x98,0x8e,0x8e,
0xee,0x8e,0xe1,0xa9,0x1e,0x8e,0xee,
0xee,0xea,0xa1,0x31,0x3a,0xa8,0xee,
0xee,0xe9,0x33,0x33,0x39,0xae,0xee,
0xee,0xee,0x33,0x33,0x1a,0xae,0xee,
0xee,0xee,0x93,0x31,0x0a,0xae,0xee,
0xee,0xee,0xe1,0x19,0xaa,0x9e,0xee,
0xee,0xee,0xec,0x9a,0xa9,0xee,0xee,
0xee,0xee,0x48,0x49,0x94,0xee,0xee,
0xee,0xee,0x48,0x84,0x84,0xee,0xee,
0xee,0xee,0x99,0x84,0x88,0xee,0xee,
0xee,0xee,0xaa,0x9a,0xaa,0xee,0xee,
0xee,0xea,0xaa,0x99,0xaa,0xee,0xee,
0xee,0xea,0xa9,0xee,0x9a,0xae,0xee,
0xee,0x44,0x9e,0xee,0x9a,0xae,0xee,
0xee,0x84,0x4e,0xee,0x94,0x4e,0xee,
0xee,0xe8,0x8e,0xee,0x44,0x4e,0xee,
0xee,0xee,0xee,0xee,0x88,0x8e,0xee,
},
{14, 26, /*width, height*/
0xee,0xee,0xee,0xee,0xee,0xee,0xee,
0xee,0xee,0xe8,0x88,0x88,0xee,0xee,
0xee,0xee,0x8d,0xd8,0xdd,0x8e,0xee,
0xee,0xe8,0x88,0x88,0x88,0xd8,0xee,
0xee,0x8d,0xcc,0xbb,0x8d,0xc8,0xee,
0xee,0xd8,0xaa,0xa9,0x8d,0x88,0xee,
0xee,0x84,0x4a,0x44,0x88,0xd8,0xee,
0xee,0xd8,0x5a,0x5f,0x88,0xd8,0xee,
0xee,0xe8,0x4a,0x4f,0xa8,0x88,0x8e,
0xee,0x88,0xaa,0xaa,0x98,0x8e,0xee,
0xee,0xee,0xe1,0xa9,0x1e,0x88,0xee,
0xee,0xee,0x93,0x33,0x39,0xae,0xee,
0xee,0xee,0x39,0xa3,0x9a,0xae,0xee,
0xee,0xee,0x3a,0x9a,0xaa,0xee,0xee,
0xee,0xee,0x91,0xa9,0x9a,0xee,0xee,
0xee,0xee,0xe1,0x11,0x0e,0xee,0xee,
0xee,0xee,0xec,0xb4,0x4e,0xee,0xee,
0xee,0xee,0x48,0x48,0x84,0xee,0xee,
0xee,0xee,0x48,0x84,0x84,0xee,0xee,
0xee,0xee,0x49,0x4a,0x94,0xee,0xee,
0xee,0xee,0xaa,0x8a,0xae,0xee,0xee,
0xee,0xee,0xaa,0x99,0xaa,0xee,0xee,
0xee,0xe4,0xa9,0xee,0x99,0xae,0xee,
0xee,0x44,0x4e,0xee,0xe4,0x44,0xee,
0xe8,0x44,0x4e,0xee,0xee,0x44,0x4e,
0xee,0x88,0xee,0xee,0xee,0x88,0x8e,
}
};
const uint8_t rock[][146]={{16, 16, //18/*width, height*/
0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,
0x77,0x77,0x65,0x67,0x77,0x77,0x77,0x64,
0x77,0x77,0x76,0x77,0x77,0x77,0x77,0x75,
0x67,0x77,0x76,0x77,0x77,0x67,0x77,0x75,
0x66,0x67,0x66,0x77,0x76,0x76,0x77,0x65,
0x56,0x66,0x66,0x67,0x77,0x77,0x66,0x65,
0x55,0x66,0x65,0x66,0x66,0x66,0x66,0x65,
0x55,0x55,0x55,0x66,0x66,0x66,0x66,0x54,
0x66,0x66,0x54,0x56,0x66,0x66,0x54,0x66,
0x56,0x66,0x65,0x45,0x66,0x64,0x46,0x66,
0x65,0x66,0x55,0x54,0x54,0x45,0x55,0x65,
0x66,0x55,0x55,0x54,0x44,0x55,0x55,0x56,
0x55,0x55,0x55,0x45,0x54,0x45,0x55,0x55,
0x55,0x55,0x44,0x55,0x55,0x44,0x45,0x55,
0x44,0x44,0x44,0x55,0x55,0x54,0x44,0x44,
0x56,0x44,0x44,0x45,0x55,0x54,0x44,0x44,
0x55,0x54,0x44,0x44,0x44,0x44,0x44,0x44,
0x44,0x44,0x44,0x44,0x44,0x44,0x45,0x44,
},{16, 18, /*width, height*/
0xee,0x11,0xee,0xee,0xee,0xee,0xee,0x11,
0x1e,0xe1,0x11,0xee,0xee,0xee,0x11,0x11,
0x1e,0xe1,0x00,0x11,0xee,0x11,0x11,0x01,
0x11,0xee,0x10,0x00,0x11,0xe1,0x10,0x1e,
0x01,0x11,0x10,0x10,0x00,0x11,0x01,0x1e,
0x10,0x11,0xe1,0x00,0x00,0x01,0x11,0xee,
0xee,0x01,0x10,0x10,0x10,0x00,0x01,0x11,
0x11,0x10,0x00,0x00,0x11,0x01,0x10,0x00,
0x10,0x01,0x10,0x01,0x11,0x10,0x01,0x00,
0x00,0x00,0x0e,0x01,0x11,0x10,0x00,0x11,
0x01,0x00,0x00,0xe0,0x01,0x11,0x00,0x00,
0x00,0x11,0x10,0xee,0x00,0x01,0x10,0x00,
0x00,0x00,0x01,0x01,0xe0,0x00,0x01,0x00,
0x10,0x00,0x10,0x00,0x11,0x10,0x00,0x11,
0x01,0x01,0x10,0x00,0x00,0x01,0x00,0x00,
0x00,0x01,0xe1,0x11,0x11,0x00,0x00,0x00,
0x10,0x01,0xee,0xee,0xe1,0x00,0x10,0x10,
0xe1,0x1e,0xee,0xee,0xe1,0x11,0xe1,0xe1,
}};
const uint8_t level[]={16, 16, /*width, height*/
0xf1,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,
0xf1,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,
0xf1,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,
0xf1,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,
0xf1,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,
0xf1,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,
0xf1,0xff,0xff,0xff,0xf1,0xff,0xff,0xf0,
0xf1,0xff,0xff,0xff,0xff,0x1f,0xff,0xf0,
0xf0,0x11,0x1f,0xff,0xff,0xff,0xff,0xf0,
0xf0,0xff,0xff,0xff,0xff,0xff,0xf0,0x00,
0xf0,0xff,0xff,0xff,0xff,0xff,0x11,0xf0,
0xf0,0xff,0xff,0x11,0x11,0xff,0xff,0xf0,
0xf1,0xff,0xff,0xff,0xff,0x1f,0xff,0xf0,
0xf0,0x00,0xff,0xff,0xff,0xf1,0xff,0xf0,
0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};


3 Likes

Are you making binaries already?

yea it work alright
platfrom-test.bin (28.0 KB)

have a couple iseus with the lagecy code of the other games, would like to see if theres any new generated documentation

Can you make little introduction to physics library? It can be really useful.

pretty sure there is no physics library atm

I think there is a physics lib

1 Like

here this might be helpfull, though the way im doing is specific for platformers

I hope this doesn’t sound rude, but are you new-ish to programming and/or C++?

uhm i wrote 4BS sprite/pallet converter for png, tga, bmp, psd
and the tutorials so far
have like 5 years in lua and seen 10 other languages
i have a only a year of education c/c++ in school but my main problem is mathematics and algebra
@Pharap why you ask?

1 Like

I have no educational background for programming and I am using C for nearly 1 year. I am still beginner in programming and English. Sometimes it’s hard to understand English for me. Because we have one of the worst educational system in the world. I’m trying to improve my skills :slight_smile:

2 Likes

yea tell me about it, second language is french in my education system.
wow we are getting of topic here.

2 Likes

Partly a lack of structs/classes, partly because your code is a bit hard to follow
e.g. one or two really long lines, several long/complex expressions, various bits of repetition, using (-x + 59 instead of the equivalent 59 - x, returning 0 and 1 instead of false and true several other things.

Might just be because it’s a draft or because of stylistic difference/preference. If Lua is the only language you have significant experience with that would sort of explain the lack of classes, as would being new to C and C++.

Lua’s a nice language, I learnt Lua to use with ComputerCraft (a Minecraft mod) a few years back. It’s still my favourite scripting language (unless you count C#, but I’ve only seen that used for scripting once).

I meant @adekto :P.
That’s good to know though.

I’m a pretty strong believer in self-education (i.e. learning from internet tutorials and articles), so do not worry about not learning programming at school.

Most of my programming knowledge comes from the internet and practise, my college wasn’t the best for teaching programming.

I had to learn both French and German despite telling them I only wanted to learn French. I don’t know either well enough to hold a conversation but still got a ‘C’ in both.


While we’re at it I may as well say what my background is.

I’ve been programming for about 4-5 years now.
I have varying levels of experience with roughly 10 different languages.
(C# and C++ are my main two, the ones I like most as well as the ones I use most.)

85% to 95% of my programming knowledge has been learned from the internet, lots of practise and occaisionally a book or two.

My college didn’t really teach me that much about programming, the internet was a much better teacher.

1 Like

Oh yea im getting the hang off classes, though my lua natior I usualy put it in a struct (i know i know there basically the same just reverse priorities)

And yes its cuz im live coding it till something works fast fixes add a - here ad a constant value there

I don’t really plan qnd witout knowing what has to happen i dont think about semantics or clean code or even optimized code

Speaking of heavy use of classes I wonder how that compiles and inpacts speed. I was looking at parts of the library and some functions just call another function in another class