here i have a some what diffrent way of learning how about i give you the code that im going off and you can edit it i usally learn from looking changing it around then learning that way
here is the code
#include "DarkGDK.h"
#include <time.h>
int player;
void Load_media()
{
dbLoadImage("Media//green.bmp",1);
dbLoadImage("Media//player.bmp",2);
dbLoadImage("Media//Backdrop.bmp",3);
}
void generate_level(int num_blocks, int Xblock_size, int Yblock_size)
{
int player=100;
int gap=1000;
int Yblock=0;
dbSprite(player,10,10,2);
for(int i=0; i<num_blocks; i++)
{
Yblock=dbSpriteY(i)+dbRnd(gap);
dbSprite(i,dbRnd(500),Yblock,1);
dbSizeSprite(i, Xblock_size,Yblock_size);
}
}
int x=100;
void movement(int player)
{
if(dbRightKey()==1){x+=1;}
if(dbLeftKey()==1){x-=1;}
dbSprite(player,x,dbSpriteY(player),2);
}
void move_blocks()
{
for (int i=0; i<40; i++)
{
dbMoveSprite(i,-1);
}
}
void reset_blocks()
{
for (int i=0;i<40;i++)
{
if (dbSpriteY(i) > 1000)
{
dbSprite(i,dbRnd(500),-40,1);
}
}
}
void jumping()
{
}
void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 60 );
dbSetDisplayMode(500,900,32);
srand(time(NULL));
Load_media();
generate_level(40,40,11);
while ( LoopGDK ( ) )
{
movement(100);
move_blocks();
reset_blocks();
dbPasteImage(3,0,0);
dbSync ( );
}
return;
}
btw i learned this off of youtube but his last tutorial was kind of confusing so this would help thank you