All pastes #511519 Raw Edit

Mine

public text v1 · immutable
#511519 ·published 2007-05-26 14:10 UTC
rendered paste body
/* Mario interpreter for the iPod
 * Written from scratch by Joseph Constan (Saintjimmy5294)
 * This is just an Early Alpha Release, but
 * I plan to have the Interpreter open an external text file
 * with level data in it and load the level from there.
 * I haven't done it yet (still confused a bit w/ file pointers)
 * But until then, It's just a simple Mario Game, demo, thingy.
 */

/* Oh, and special thanks to
 * zacaj, for the idea
 * Mike Sweeney (ichaelmay8), for writing iBolo, 
 * whose level loading system I based mine off of ;)
 * Nintendo, for wowing the world with the invention of Mario,
 * Um, Apple, I guess, for making the iPod,
 * And, of course, the iPodlinux team, without whom this would not be possible.
 */

//May 17, 2007, in this program, I wrote my first 1,000 lines of code. This one's goin' in the baby book :D

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "pz.h"
#include <errno.h>
#include <string.h>

#define LBLUE 0, 240, 255							//defines value for teh color Light Blue
#define SHEIGHT (ttk_screen->h - ttk_screen->wy)    //sets SHEIGHT to the height of the screen
#define SHWIDTH (ttk_screen->w)						//sets SWIDTH to the height of the screen

static PzModule *module;

/*images (for the ones with arrays, ie. goomba[2], the number represents the frames)*/

static ttk_surface small_mario_left[2];	//small mario facing left 
static ttk_surface small_mario_right[2];	//small mario facing right
static ttk_surface mario_left[3];	//mario facing left
static ttk_surface mario_right[3];	//mario facing right
static ttk_surface flower_mario_left[3];	//flower mario facing left
static ttk_surface flower_mario_right[3];	//flower mario facing right
static ttk_surface mario_crouch_right;		//mario crouching & facing right
static ttk_surface mario_crouch_left;		//mario crouching & facing left

static ttk_surface goomba[2];		//goomba
static ttk_surface goomba_squish;		//goomba squished
static ttk_surface gkoopa_l[2];		//green koopa facing left
static ttk_surface gkoopa_r[2];		//green koopa facing right
static ttk_surface rkoopa_l[2];		//red koopa facing left
static ttk_surface rkoopa_r[2];		//red koopa facing right
static ttk_surface redshell[4];		//red shell spinning
static ttk_surface greenshell[4];	//green shell spinning

static ttk_surface ground;		//image of ground (brick)
static ttk_surface block;		//coin block
static ttk_surface qblock[4];		//question mark (powerup) block
static ttk_surface coin[4];		//coin image
static ttk_surface mushroom;	//mushroom
static ttk_surface 1up;	//green mushroom (extra life)
static ttk_surface flower;		//power flower
//static ttk_surface star[4];		//star for to give you teh invinsiblity!!!11!1!!
static ttk_surface fireball[4];	//OH NOES!! T3h f1r3b4l1 0f z3h d3th!!1! run 4w4yz!

/*variable declarations (brace yourself there's a lot of them)*/

static int mario_x;				//x coordinate of mario
static int mario_y;				//y coordinate of mario
static int goomba_x[100];			//x coordinate of goomba
static int goomba_y[100];			//y coordinate of goomba
static int gkoopa_x[100];			//x coordinate of teh green koopa
static int gkoopa_y[100];			//y coordinate of teh green koopa
static int rkoopa_x[100];			//x coordinate of teh red koopa
static int rkoopa_y[100];			//y coordinate of teh red koopa

static int ground_x[100];			//x coordinate of the ground
static int ground_y[100];			//y coordinate of the ground
static int block_x[100];			//x coordinate of block
static int block_y[100];			//y coordinate of block
static int qblock_x[100];			//x coordinate of question mark block
static int qblock_y[100];			//y coordinate of question mark block
static int coin_x[100];				//x coordinate of coin
static int coin_y[100];				//y coordinate of coin
static int mushroom_x;			//I think you get the idea by now, if not, get some help
static int mushroom_y;
static int 1up_x;
static int 1up_y;
static int flower_x;
static int flower_y;
//static int star_x;
//static int star_y;
static int fireball_x[2];
static int fireball_y[2];
static int start_x;
static int start_y;
static int end_x;
static int view_x=0;				//left end of viewport				
static int view_y=0;				//bottom of viewport
static int view_w=SWIDTH;			//width of viewport, automatically set to the width of the iPod's screen
static int view_h=SHEIGHT;			//height of viewport, automatically set to the height of the iPod's screen
static int eframe=0;				//frame for the animation of koopas and goombas
static int mframe=0;				//frame for the animation of mario
static int mdirection;			//direction mario [0], green koopa [1] or red koopa [2] is facing, 1=left. 2=right
static int mwalk=0;					//if mario is moving (running or walking), 1=yes, 0=no
static int mjump=0;					//if mario is jumping, 1=yes, 0=no
static int mrun=0;					//if mario is running, 1=running, 0=walking
static int mcrouch=0;				//if mario is crouching, 1=yes, 0=no
static int invincible=0;			//if mario is unnnnn-tuchable
static int fallpt;					//when mario starts falling after he jumps
static int onground;				//if mario is on the ground
static int buttondown[5]={0,0,0,0,0};	//if button is down, 1=yes, 2=no; [0]=select, 1=menu, 2=prev, 3=next, 4=down
static int rkoopa_direction[100];
static int gkoopa_direction[100];
static int i=0, j=0, k=0, l=0, m=0, n=0, o=0, p=0, q=0, r=0, s=0, t=0, u=0, v=0, w=0, a=0, b=0;	//don't ask

static int goomba_state[100];		/*whether goomba is alive (1), squished (2), or dead(0)*/
static int rkoopa_state[100];		/*whether red koopa is alive (1), in shell (2), or dead(0)*/
static int gkoopa_state[100];		/*whether green koopa is alive (1), in shell (2), or dead(0)*/

static int item_state[4]=(1,1,1,1);		/*whether item is unused (item_state[]=1) or used(=0).
										Array: [1] - mushroom, [2] - green mushroom, [3] - power flower, [0] - star*/

static int item_direction[3]=(1,1,1);	//self explanatory, 1=left, 2=right, [0] - mushroom, [2] - green mushroom, [0] - star

static int block_state[100];		//whether block is unhit (block_state[]=1, being hit(2), or hit(=0)

static int qblock_state[100];		//same as above

static int coin_state[100];			//same as above

static int mario_state=1;		//whether mario is small (1), big (2), flower (3), or, heaven forbid, dead (0)

static int mxspeed=0;			//mario's horizontal speed
static int myspeed=0;			//No, not "my speed", mario's vertical speed
static int rkxspeed[100];			//red koopa's horizontal speed
static int rkyspeed[100];			//red koopa's vertical speed
static int gkxspeed[100];			//green koopa's horizontal speed
static int gkyspeed[100];			//green koopa's vertical speed
static int gxspeed[100];			//goomba's horizontal speed
static int gyspeed[100];			//goomba's vertical speed

static int lives=3;
static int coins=0;
static int score=0;

static int lvl_width=20;
static int lvl_height=14;
static int lvl_tiles=lvl_width*lvl_height;


static char leveldata1[lvl_tiles]={ .,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,
								    .,Q,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,., 
								    .,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,
								    C,C,C,C,C,C,.,.,.,.,.,.,.,.,.,.,.,.,.,.,	
								    B,B,B,B,B,B,C,.,.,.,.,.,.,.,.,.,.,.,.,.,
								    .,.,.,.,.,.,B,C,.,.,.,.,.,.,.,.,.,.,.,.,
								    .,.,.,.,.,.,.,B,C,.,.,.,.,.,.,.,.,.,.,.,	
								    .,.,.,.,.,.,.,.,B,.,.,.,.,k,.,.,.,.,.,.,	
								    .,.,.,.,.,.,.,.,.,B,B,B,B,B,B,.,.,.,.,.,	//The Leveldata is the information 
								    .,Q,B,.,.,.,.,.,.,.,.,.,.,.,.,.,.,B,.,.,	//used to load the level, such as
								    .,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,B,B,.,.,	//locations of start and end loca-
								    S,.,.,.,B,g,.,.,.,r,.,B,C,C,C,B,B,B,.,E,	//tions. It uses an array based on
								    G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,	//the size of the level, which is
								    G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G};	//height * width.

//Done with declarations, starting the game (sorta)
static void draw_mario(PzWidget *wid, ttk_surface srf)
{
	int x=0;
	int y=0;
	int tilex=0;
	int tiley=0;

	ttk_fillrect (srf, 0, 0, SWIDTH, SHEIGHT, ttk_makecol(LBLUE));

	/*Level Drawing (I'm confused on this part and will probably screw up, but bear with me here) (Most of the stuff is explained in the block functiony thingy)*/
		while(y<lvl_width)	
			{
				if(leveldata1[x]==G)//ground
				{
				        
						if(ground_x[i]>view_x && ground_x[i]<view_x+view_w && ground_y[i]>view_y && ground_y[i]<view_y+view_h) 
						{
							ttk_blit_image (ground, srf, ground_x[i] - view_x, ground_y[i] - view_y);
							ground_y=tiley;
							ground_x=tilex;
						}
						i++;
						if(i=99)
						i=0;
				}              
				if(leveldata1[x]==S)//start point
				{
						start_x=tilex;
						start_y=tiley;
				}
				if(leveldata1[x]==E)//end point
				{
						end_x=tilex;
						end_y=tiley;
				}
				if(leveldata1[x]==B && block_state[j]!=0)//regular block
				{
						
						if(block_x[j]>view_x && block_x[j]<view_x+view_w && block_y[j]>view_y && block_y[j]<view_y+view_h && block_state[j]!=0) //checks if the block is on the screen (if it only has to worry about stuff thats on the screen, it saves a lot of memory and stuff (thats how Nintendo did it ;D))
						{
							block_x[j]=tilex;	//sets the block's x coordinate (block_x) to the tile it is currently checking
							block_y[j]=tiley;	//sets the block's y coordinate to the current tile
							if(block_state[j]==1)	//if the block is not broken
							ttk_blit_image (block, srf, block_x[j] - view_x, block_y[j] - view_y);	//draws the image
							else if(block_state[j]==2)	//if block is being hit
							{
							ttk_blit_image (block, srf, block_x[j] - view_x - 4, block_y[j] - view_y - 4);	//draws the image 4 px higher than usual
							}
						}
						j++;		//with all this code, I almost look like I know what I'm doing =O
						if(j==99)
						j=0;
				}
				if(leveldata1[x]==Q)//? powerup block
				{
						if(qblock_x[k]>view_x && qblock_x[k]<view_x+view_w && qblock_y[k]>view_y && qblock_y[k]<view_y+view_h) 
						{
							qblock_x[k]=tilex;
							qblock_y[k]=tiley;
							if(qblock_state[k]=1)
							ttk_blit_image (qblock[qframe], srf, qblock_x[k] - view_x, qblock_y[k] - view_y);
							else if(qblock_state[k]==2)
							{
							ttk_blit_image (qblock[qframe], srf, qblock_x[k] - view_x - 5, qblock_y[k] - view_y - 5);
							}
							else
							ttk_blit_image (usedblock, srf, qblock_x[k] - view_x, qblock_y[k] - view_y);
						}
						k++;
						if(k==99)
						k=0;
				}
				/*if(star_x[b]>view_x && star_x[b]<view_x+view_w && star_y[b]>view_y && star_y[b]<view_y+view_h) 
						{
							star_x[b]=tilex;
							star_y[b]=tiley;
							if(qblock_state=1)
							ttk_blit_image (qblock[qframe], srf, qblock_x[k] - view_x, qblock_y[k] - view_y);
							else if(qblock_state[k]==2)
							{
							ttk_blit_image (qblock, srf, qblock_x[k] - view_x - 5, qblock_y[k] - view_y - 5);
							}
							else
							ttk_blit_image (usedblock, srf, qblock_x[k] - view_x, qblock_y[k] - view_y);
						}
						k++;
						if(k==99)
						k=0;
				*/
				if(leveldata1[x]==C && coin_state[l]!=0)//coin
				{
						if(coin_x[l]>view_x && coin_x[l]<view_x+view_w && coin_y[l]>view_y && coin_y[l]<view_y+view_h) 
						{
							coin_x[l]=tilex;
							coin_y[l]=tiley;
							ttk_blit_image (coin[qframe], srf, coin_x[l] - view_x, coin_y[l] - view_y);
							l++;
						}
						if(l==99)
						l=0;
				}
				if(leveldata1[x]==g)//goomba
				{
				        if(goomba_x[m]>view_x && goomba_x[m]<view_x+view_w && goomba_y[m]>view_y && goomba_y[m]<view_y+view_h)
						{
						goomba_x[m]=tilex;
						goomba_y[m]=tiley;
						m++;
						}
						if(m==99)
						m=0;
				}
				if(leveldata1[x]==r)//red koopa
				{
				        if(rkoopa_x[n]>view_x && rkoopa_x[n]<view_x+view_w && rkoopa_y[n]>view_y && rkoopa_y[n]<view_y+view_h)
						{
						rkoopa_x[n]=tilex;
						rkoopa_y[n]=tiley;
						n++;
						}
						if(n==99)
						n=0;
				}
				if(leveldata1[x]==k)//green koopa
				{
				        if(gkoopa_x[o]>view_x && gkoopa_x[o]<view_x+view_w && gkoopa_y[o]>view_y && gkoopa_y[o]<view_y+view_h)
						{
						gkoopa_x[o]=tilex;
						gkoopa_y[o]=tiley;
						o++;
						}
						if(o==99)
						o=0;
				}
				x++;
				tilex=tilex+16;
				if(tilex==144)
				{
					tilex=0;
					y++;
					tiley=tiley+16;
				}
			}
			mario_x=start_x;
			mario_y=start_y+12;
			draw_images();
	}

	static void draw_images()
	{
		if(mushroom_x>view_x && mushroom_x<view_x+view_w && mushroom_y>view_y && mushroom_y<view_y+view_h && item_state[1]==1) 
				{
					ttk_blit_image (mushroom, srf, mushroom_x - view_x, mushroom_y - view_y);
				}
		if(goomba_x[p]>view_x && goomba_x[p]<view_x+view_w && goomba_y[p]>view_y && goomba_y[p]<view_y+view_h && goomba_state[p]!=0) 
				{
					if(goomba_state==1)
					ttk_blit_image (goomba[eframe], srf, goomba_x[p] - view_x, goomba_y[p] - view_y);
					else if(goomba_state==2)
					ttk_blit_image (goomba_squished, srf, goomba_x[p] - view_x, (goomba_y[p] + 8) - view_y);
					p++;
					if(p==99)
						p=0;
				}
		if(gkoopa_x[q]>view_x && gkoopa_x[q]<view_x+view_w && gkoopa_y[q]>view_y && gkoopa_y[q]<view_y+view_h && gkoopa_state[q]!=0) 
				{
					if(gkoopa_state==1)
					{
						if(gkoopa_direction[q]==1)
						ttk_blit_image (gkoopa_l[eframe], srf, gkoopa_x[q] - view_x, gkoopa_y[q] - view_y);
						if(gkoopa_direction[q]=2)
						ttk_blit_image (gkoopa_r[eframe], srf, gkoopa_x[q] - view_x, gkoopa_y[q] - view_y);
					}
					else if(gkoopa_state==2)
						ttk_blit_image (greenshell[qframe], srf, gkoopa_x[q] - view_x, (gkoopa_y[q] - 9) - view_y);
					q++;
					if(q==99)
						q=0;
				}
		if(rkoopa_x[r]>view_x && rkoopa_x[r]<view_x+view_w && rkoopa_y[r]>view_y && rkoopa_y[r]<view_y+view_h && rkoopa_state[r]!=0) 
				{
					if(rkoopa_state==1)
					{
						if(rkoopa_direction[r]==1)
						ttk_blit_image (gkoopa_l[eframe], srf, gkoopa_x[q] - view_x, gkoopa_y[q] - view_y);
						if(rkoopa_direction[r]=2)
						ttk_blit_image (gkoopa_r[eframe], srf, gkoopa_x[q] - view_x, gkoopa_y[q] - view_y);
					}
					else if(gkoopa_state==2)
						ttk_blit_image (greenshell[qframe], srf, gkoopa_x[q] - view_x, (gkoopa_y[q] - 9) - view_y);
					r++;
					if(r==99)
						r=0;
				}
		if(mario_x>view_x && mario_x<view_x+view_w && mario_y>view_y && mario_y<view_y+view_h)
				{
					if(mdirection==1 && mario_state==1 && mwalk==1 && mcrouch==0)			//if mario is small and walking left
					ttk_blit_image (small_mario_left[eframe], srf, mario_x - view_x, mario_y - (view_y + 9));
					if(mdirection==1 && mario_state==1 && mwalk==0 && mcrouch==0)	//if mario is small and standing left
					ttk_blit_image (small_mario_left[0], srf, mario_x - view_x, mario_y - (view_y + 9));
					if(mdirection==1 && mario_state==2 && mwalk==1 && mcrouch==0)	//if mario is big and walking left
					ttk_blit_image (mario_left[mframe], srf, mario_x - view_x, mario_y - view_y);
					if(mdirection==1 && mario_state==2 && mwalk==0 && mcrouch==0)	//if mario is big and standing left
					ttk_blit_image (mario_left[0], srf, mario_x - view_x, mario_y - view_y);
					if(mdirection==1 && mario_state==3 && mwalk==1 && mcrouch==0)	//if mario has flower powers and is walking left
					ttk_blit_image (flower_mario_left[mframe], srf, mario_x - view_x, mario_y - view_y);
					if(mdirection==1 && mario_state==3 && mwalk==0 && mcrouch==0)	//if mario has flower powers and is standing left
					ttk_blit_image (flower_mario_left[0], srf, mario_x - view_x, mario_y - view_y);
					if(mdirection==2 && mario_state==1 && mwalk==1 && mcrouch==0)			//if mario is small and walking right
					ttk_blit_image (small_mario_right[eframe], srf, mario_x - view_x, mario_y - view_y);
					if(mdirection==2 && mario_state==1 && mwalk==0 && mcrouch==0)	//if mario is small and standing right
					ttk_blit_image (small_mario_right[0], srf, mario_x - view_x, mario_y - (view_y + 9));
					if(mdirection==2 && mario_state==2 && mwalk==1 && mcrouch==0)	//if mario is big and walking right
					ttk_blit_image (mario_right[mframe], srf, mario_x - view_x, mario_y - (view_y + 9));
					if(mdirection==2 && mario_state==2 && mwalk==0 && mcrouch==0)	//if mario is big and standing right
					ttk_blit_image (mario_right[0], srf, mario_x - view_x, mario_y - view_y);
					if(mdirection==2 && mario_state==3 && mwalk==1 && mcrouch==0)	//if mario has flower powers and is walking right
					ttk_blit_image (flower_mario_right[mframe], srf, mario_x - view_x, mario_y - view_y);
					if(mdirection==2 && mario_state==3 && mwalk==0 && mcrouch==0)	//if mario has flower powers and is standing right
					ttk_blit_image (flower_mario_right[0], srf, mario_x - view_x, mario_y - view_y);
					if(mdirection==1 && mcrouch==1)			//if mario is crouching and is facing left
					ttk_blit_image (flower_mario_right[mframe], srf, mario_x - view_x, mario_y - view_y);
					if(mdirection==2 && mcrouch==1)			//if mario is crouching and is facing right
					ttk_blit_image (flower_mario_right[0], srf, mario_x - view_x, mario_y - view_y);			
					else if(mario_state=0)									//mario is dead-dead
					lives=lives-1;
				}
		mframe++;		//changes frame for mario's animation
		if(mframe==2)
			mframe=0;		
		eframe++;		//changes frame for teh enemy animations,
		if(eframe==1)	//and since koopas and goombas only have
			eframe=0;	//2 frames, I only need 1 variable for them all :D.
		qframe++;
		if(qframe==3)
			qframe=0;
	}
if(t=2)//<- remember to fix this part so it only happens when there are less than 2 fireballs on the screen
t=0;
if(mwalk==1 && mrun==0 && mdirection=2)	//mario is walking right (but not running cuz he might trip :o)
mxspeed=4;
if(mwalk==1 && mrun==1 && mdirection=2)	//mario is running right (but be careful now, don't go too fast ;))
mxspeed=6;
if(mwalk==1 && mrun==0 && mdirection=1)	//mario is walking left
mxspeed=-4;
if(mwalk==1 && mrun==1 && mdirection=1)	//mario is running left
mxspeed=-6;
if(mwalk==0)									//mario's a just standin der, chillin
mxspeed=0;
if(mjump==1 && onground==1)					//mario wants to jump and is on the ground
{
	fallpt=mario_y-64;
	myspeed=4;
}
if(mario_x>=fallpt)							//the (fake and badly coded) gravity kicks in and mario starts to fall
myspeed--;
if(myspeed<-4)							//gravity is just too much
myspeed=-4;
if(myspeed>4)							//going up too fast
myspeed=4;
if(mario_state!=0 && myspeed!=0) //mario is not on the ground
mario_y=mario_y-myspeed;
if(mario_state!=0 && mxspeed!=0)
mario_x=mario_x+mxspeed;
if(onground=0 && myspeed<=0 && myspeed!=-4)//there's probably a better way to do this, I'm just too lazy to figure it out
myspeed--;
if(mario_state==1)		//Mario is small
{
	if(mario_x<ground_x[u]+16 && mario_x+16>ground_x[u] && mario_y+19<=ground_y[u]+16 && mario_y+19>=ground_y[u])	//mario is on a block of ground
	onground=1;
	if(mario_x<block_x[u]+16 && mario_x+16>block_x[u] && mario_y+19<=block_y[u]+16 && mario_y+19>=ground_y[u])	//mario is on a block
	onground=1;
	if(mario_x<qblock_x[u]+16 && mario_x+16>qblock_x[u] && mario_y+19<=qblock_y[u]+16 && mario_y+19>=ground_y[u])	//mario is on a [?] block
	onground=1;
	else
	onground=0;
	if(mario_x>=rkoopa_x[u]-16 && mario_x<=rkoopa_x[u]+8 && mario_y+19>=rkoopa_y[u] && mario_y+19<=rkoopa_y[u]+16 && myspeed<0)
	{
		if(rkoopa_state[u]==1)
		{
			if(mario_y+19>rkoopa_y[u]+8 && myspeed<0)
			{
				lives--;
				mario_die();
			}
			else
			{
				myspeed=4;
				rkoopa_state[u]=2;
			}
		}
		else if(rkoopa_state==2)
		{
			if(mario_y+19>rkoopa_y[u]+8 && myspeed<0)
			{
				lives--;
				mario_die();
			}
			else
			{
				rkxspeed[u]=-6;
				myspeed=4;
			)
		}
	}
	if(mario_x>rkoopa_x[u]+8 && mario_x<=rkoopa_x[u]+16 && mario_y+19>=rkoopa_y[u] && mario_y+19<=rkoopa_y[u]+16 && myspeed<0)
	{
		if(rkoopa_state[u]==1)
		{
			if(mario_y+19>rkoopa_y[u]+8 && myspeed<0)
			{
				lives--;
				mario_die();
			}
			else
			{
				myspeed=4;
				rkoopa_state[u]=2;
			}
		}
		else if(rkoopa_state==2)
		{
			if(mario_y+19>rkoopa_y[u]+8 && myspeed<0)
			{
				lives--;
				mario_die();
			}
			else
			{
				rkxspeed[u]=-6;
				myspeed=4;
			)
		}
	}
	if(mario_x>=gkoopa_x[u]-16 && mario_x<=gkoopa_x[u]+8 && mario_y+19>=gkoopa_y[u] && mario_y+19<=gkoopa_y[u]+16 && myspeed<0)
	{
		if(gkoopa_state[u]==1)
		{
			if(mario_y+19>gkoopa_y[u]+8 && myspeed<0)
			{
				lives--;
				mario_die();
			}
			else
			{
				myspeed=4;
				gkoopa_state[u]=2;
			}
		}
		else if(gkoopa_state==2)
		{
			if(mario_y+19>gkoopa_y[u]+8 && myspeed<0)
			{
				lives--;
				mario_die();
			}
			else
			{
				gkxspeed[u]=-6;
				myspeed=4;
			)
		}
	}
	if(mario_x>gkoopa_x[u]+8 && mario_x<=gkoopa_x[u]+16 && mario_y+19>=gkoopa_y[u] && mario_y+19<=gkoopa_y[u]+16 && myspeed<0)
	{
		if(gkoopa_state[u]==1)
		{
			if(mario_y+19>gkoopa_y[u]+8 && myspeed<0)
			{
				lives--;
				mario_die();
			}
			else
			{
				myspeed=4;
				gkoopa_state[u]=2;
			}
		}
		else if(gkoopa_state==2)
		{
			if(mario_y+19>gkoopa_y[u]+8 && myspeed<0)
			{
				lives--;
				mario_die();
			}
			else
			{
				gkxspeed[u]=-6;
				myspeed=4;
			)
		}
	}
if(mario_x>=goomba_x[u]-16 && mario_x<=goomba_x[u]+16 && mario_y+19>=goomba_y[u] && mario_y+19<=goomba_y[u]+16 && myspeed<0)
	{
		if(myspeed<0)
		{
			myspeed=4;
			goomba_state[u]=2;
		}
		else if(myspeed!<0)
		{
			lives--;
			mario_die();
		}
	}
}
if(mario_state==2 || mario_state==3)	//Mario is big or flower
{
	if(mario_x<ground_x[u]+16 && mario_x+16>ground_x[u] && mario_y+28<=ground_y[u]+16 && mario_y+28>=ground_y[u])	//mario is on a block of ground
	onground=1;
	if(mario_x<block_x[u]+16 && mario_x+16>block_x[u] && mario_y+28<=block_y[u]+16 && mario_y+28>=block_y[u])	//mario is on a block
	onground=1;
	if(mario_x<qblock_x[u]+16 && mario_x+16>qblock_x[u] && mario_y+28<=qblock_y[u]+16 && mario_y+28>=qblock_y[u]))	//mario is on a [?] block
	onground=1;
	else
	onground=0;
	if(mario_x>=rkoopa_x[u]-16 && mario_x<=rkoopa_x[u]+8 && mario_y+28>=rkoopa_y[u] && mario_y+28<=rkoopa_y[u]+16 && myspeed<0)
	{
		if(rkoopa_state[u]==1)
		{
			if(mario_y+28>rkoopa_y[u]+8 && myspeed<0)
			{
				mario_state=1;
			}
			else
			{
				myspeed=4;
				rkoopa_state[u]=2;
			}
		}
		else if(rkoopa_state==2)
		{
			if(mario_y+28>rkoopa_y[u]+8 && myspeed<0)
			{
				mario_state=1;
			}
			else
			{
				rkxspeed[u]=-6;
				myspeed=4;
			)
		}
	}
	if(mario_x>rkoopa_x[u]+8 && mario_x<=rkoopa_x[u]+16 && mario_y+28>=rkoopa_y[u] && mario_y+28<=rkoopa_y[u]+16 && myspeed<0)
	{
		if(rkoopa_state[u]==1)
		{
			if(mario_y+28>rkoopa_y[u]+8 && myspeed<0)
			{
				mario_state=1;
			}
			else
			{
				myspeed=4;
				rkoopa_state[u]=2;
			}
		}
		else if(rkoopa_state==2)
		{
			if(mario_y+28>rkoopa_y[u]+8 && myspeed<0)
			{
				mario_state=1;
			}
			else
			{
				rkxspeed[u]=-6;
				myspeed=4;
			)
		}
	}
	if(mario_x>=gkoopa_x[u]-16 && mario_x<=gkoopa_x[u]+8 && mario_y+28>=gkoopa_y[u] && mario_y+28<=gkoopa_y[u]+16 && myspeed<0)
	{
		if(gkoopa_state[u]==1)
		{
			if(mario_y+28>gkoopa_y[u]+8 && myspeed<0)
			{
				mario_state=1;
			}
			else
			{
				myspeed=4;
				gkoopa_state[u]=2;
			}
		}
		else if(gkoopa_state==2)
		{
			if(mario_y+28>gkoopa_y[u]+8 && myspeed<0)
			{
				mario_state=1;
			}
			else
			{
				gkxspeed[u]=-6;
				myspeed=4;
			)
		}
	}
	if(mario_x>gkoopa_x[u]+8 && mario_x<=gkoopa_x[u]+16 && mario_y+28>=gkoopa_y[u] && mario_y+28<=gkoopa_y[u]+16)	//Mario is touching the eft side of the green koopa
	{
		if(gkoopa_state[u]==1)
		{
			if(mario_y+28>gkoopa_y[u]+8 && myspeed<0)
			{
				mario_state=1;
			}
			else
			{
				myspeed=4;
				gkoopa_state[u]=2;
			}
		}
		else if(gkoopa_state==2)
		{
			if(mario_y+28>gkoopa_y[u]+8 && myspeed<0)
			{
				mario_state=1;
			}
			else
			{
				gkxspeed[u]=-6;
				myspeed=4;
			)
		}
	}
	if(mario_x>=goomba_x[u]-16 && mario_x<=goomba_x[u]+16 && mario_y+28>=goomba_y[u] && mario_y+28<=goomba_y[u]+16 && goomba_state[u]==1)
	{
		if(myspeed<0)
		{
			myspeed=4;
			goomba_state[u]=2;
		}
		else if(myspeed!<0)
		{
			mario_state=1;
		}
	}
	if(mario_x>=mushroom_x-16 && mario_x<=mushroom_x+16 && mario_y+28>=mushroom_y && mario_y+28<=mushroom_y+16)
	{
	 mario_state=2;
	 score=score+1000;
	 item_state[1]=0;
	}
	if(mario_x>=1up_x-16 && mario_x<=1up_x+16 && mario_y+28>=1up_y && mario_y+28<=1up_y+16)
	{
	 lives++;
	 score=score+1000;
	 item_state[3]=0;
	}
	 if(mario_x>=flower_x-16 && mario_x<=flower_x+16 && mario_y+28>=flower_y && mario_y+28<=flower_y+16)
	{
	 mario_state=3;
	 score=score+1000;
	 item_state[3]=0;
	}
	if(mario_x>=coin_x[u]-16 && mario_x<=coin_x[u]+16 && mario_y+28>=coin_y[u] && mario_y+28<=coin_y[u]+16)
	 {
	  coins++;
	  score=score+100;
	  coin_state[u]=0;
	 }
}
if(onground==1 && myspeed<0)	//If Mario is falling and hits the ground
myspeed=0;		//break the fall (so he doesn't go through the ground of course)
if(mario_x<=block_x[u]+16 && mario_x+16>=block_x[u] && mario_y<=block_y[u]+16 && mario_y>=block_y[u] && myspeed>2)	//mario hits a block (from under it)
{
myspeed=myspeed*-1;	//reverse vertical speed
block_state[u]=2;	//tell the computer that the block was hit but hasn't paid its coin yet
}
/*All the stuff for the viewport system*/
if(view_x+(view_w/2)<mario_x && view_x+view_h!>lvl_width*16)
view_x=view_x+mxspeed;
if(view_x+(view_w/2)>mario_x && view_x!<0)
view_x=view_x+mxspeed;
if(view_y+(view_h/2)<mario_y && view_y+view_h!>lvl_height*16)
view_y=view_y+myspeed;
if(view_y+(view_h/2)>mario_y && view_y!<0)
view_y=view_y+myspeed;

if(rkoopa_state[u]!=0)
{
	if(rkoopa_y[u]<block_y[w]+16 && rkoopa_y[u]>block_y[w]-16 && rkoopa_x[u]<=block_x[w] && rkoopa_x[u]>=block_x[w]-16 && )
	{
	rkxspeed[u]=rkxspeed[u]*-1;
	if(rkoopa_state=2)
		block_state[w]=2;
	}
	else if(rkoopa_y[u]<block_y[w]+16 && rkoopa_y[u]>block_y[w]-16 && rkoopa_x[u]>=block_x[w] && rkoopa_x[u]<=block_x[w]+16)
	{
	rkxspeed[u]=rkxspeed[u]*-1;	
	if(rkoopa_state=2)
		block_state[w]=2;
	}
	else if(rkoopa_y[u]<qblock_y[w]+16 && rkoopa_y[u]>qblock_y[w]-16 && rkoopa_x[u]<=qblock_x[w] && rkoopa_x[u]>=qblock_x[w]-16)
	{
	rkxspeed[u]=rkxspeed[u]*-1;	
	if(rkoopa_state=2)
		qblock_state[w]=2;
	}
	else if(rkoopa_y[u]<qblock_y[w]+16 && rkoopa_y[u]>qblock_y[w]-16 && rkoopa_x[u]>=qblock_x[w] && rkoopa_x[u]<=qblock_x[w]+16)
	{		
		rkxspeed[u]=rkxspeed[u]*-1;
		if(rkoopa_state=2)
			qblock_state[a]=2;
	}
	else if(rkoopa_y[u]<ground_y[w]+16 && rkoopa_y[u]>ground_y[w]-16 && rkoopa_x[u]<=ground_x[w] && rkoopa_x[u]>=ground_x[w]-16)
	{
	rkxspeed[u]=rkxspeed[u]*-1;	
	}
	else if(rkoopa_y[u]<ground_y[w]+16 && rkoopa_y[u]>ground_y[w]-16 && rkoopa_x[u]>=ground_x[w] && rkoopa_x[u]<=ground_x[w]+16)
	{		
		rkxspeed[u]=rkxspeed[u]*-1;
	}
	/*this is the part where a red koopa is at the edge of a platform and turns around (badly coded, 'cuz I'm tired)*/
	else if((rkoopa_y[u]+25!>ground_y[w] && rkoopa_y[u]+39!<ground_y[w] && rkoopa_x[u]!>ground_x && rkoopa_x!<ground_x-16) && (rkoopa_y[u]+25!>block_y[w] && rkoopa_y[u]+39!<block_y[w] && rkoopa_x[u]!>block_x && rkoopa_x!<block_x-16) && (rkoopa_y[u]+25!>qblock_y[w] && rkoopa_y[u]+39!<qblock_y[w] && rkoopa_x[u]!>qblock_x && rkoopa_x!<qblock_x-16)
	(
		if(rkoopa_sttate[u]==1)
		{
		rkxspeed[u]=rkxspeed[u]*-1;
		}
		else if(rkoopa_state[u]==20
		{
		rkyspeed[u]=-4;
		}
	}
	else if(w==99)
	w=0;
	else
	w++;
}
if(gkoopa_state[u]!=0)
{
	if(gkoopa_y[u]<block_y[a]+16 && gkoopa_y[u]>block_y[a]-16 && gkoopa_x[u]<=block_x[a] && gkoopa_x[u]>=block_x[a]-16)
	{	
		gkxspeed[u]=gkxspeed[u]*-1;
		if(gkoopa_state=2)
			block_state[a]=2;
	}
	else if(gkoopa_y[u]<block_y[a]+16 && gkoopa_y[u]>block_y[a]-16 && gkoopa_x[u]>=block_x[a] && gkoopa_x[u]<=block_x[a]+16)
	{	
		gkxspeed[u]=gkxspeed[u]*-1;
		if(gkoopa_state=2)
			block_state[a]=2;
	}
	else if(gkoopa_y[u]<qblock_y[a]+16 && gkoopa_y[u]>qblock_y[a]-16 && gkoopa_x[u]<=qblock_x[a] && rkoopa_x[u]>=qblock_x[a]-16)
	{	
		gkxspeed[u]=gkxspeed[u]*-1;
		if(gkoopa_state=2)
			qblock_state[a]=2;
	}
	else if(gkoopa_y[u]<qblock_y[a]+16 && gkoopa_y[u]>qblock_y[a]-16 && gkoopa_x[u]>=qblock_x[a] && gkoopa_x[u]<=qblock_x[a]+16)
	{		
		gkxspeed[u]=gkxspeed[u]*-1;
		if(gkoopa_state=2)
			qblock_state[a]=2;
	}
	else if((gkoopa_y[u]+25!>ground_y[w] && gkoopa_y[u]+39!<ground_y[w] && gkoopa_x[u]!>ground_x && gkoopa_x!<ground_x-16) && (gkoopa_y[u]+25!>block_y[w] && gkoopa_y[u]+39!<block_y[w] && gkoopa_x[u]!>block_x && gkoopa_x!<block_x-16) && (gkoopa_y[u]+25!>qblock_y[w] && gkoopa_y[u]+39!<qblock_y[w] && gkoopa_x[u]!>qblock_x && gkoopa_x!<qblock_x-16)
	{
	gkyspeed=-4;
	}
	else if(a==99)
	a=0;
	else
	a++;
}

if(qblock_state[u]==2)
{
	if(mario_state==1)
	{
	mushroom_y=qblock_y[u]+16;
	mushroom_x=qblock_x[u];
	item_direction[1]=2;
	qblock_state[u]=0;
	}
	if(mario_state==2 || mario_state==3
	{
	flower_y=qblock_y[u]+16;
	flower_x=qblock_x[u];
	qblock_state[u]=0;
	}
}
if(block_state[u]==2)
{
	ttk_blit_image (coin[0], srf, block_x[u], block_y[u]+16));
	coins++;
	block_state[u]=0;
}
if(item_state[1]!=0)
{
	if(mushroom_y[u]<block_y[a]+16 && mushroom_y[u]>block_y[a]-16 && mushroom_x[u]<=block_x[a] && mushroom_x[u]>=block_x[a]-16)	//mushroom hit the left of the block
	{	
		item_direction[1]=2;
	}
	else if(mushroom_y[u]<block_y[a]+16 && mushroom_y[u]>block_y[a]-16 && mushroom_x[u]>=block_x[a] && mushroom_x[u]<=block_x[a]+16)	//mushroom hit the right of the block
	{	
		item_direction[1]=1;
	}
	else if(mushroom_y[u]<qblock_y[a]+16 && mushroom_y[u]>qblock_y[a]-16 && mushroom_x[u]<=qblock_x[a] && mushroom_x[u]>=qblock_x[a]-16)	//mushroom hit the left of the [?] block
	{	
		item_direction[1]=2;
	}
	else if(mushroom_y<qblock_y[v]+16 && mushroom_y[u]>qblock_y[v]-16 && mushroom_x[u]>=qblock_x[v] && mushroom_x[u]<=qblock_x[v]+16)	//mushroom hit the right of the [?] block
	{		
		item_direction[1]=1;
	}
	else if(v==99)
	v=0;
	else
	v++;
}
u++;
if(u==99)
	u=0;
if(mario_y==end_y)
{
ttk_blit_image (win, srf, 0, 0);
game_over();
}
//bookmark (add code for star and crouching, then finish up these 2 funcions and make sure everything else is all good, compile, and test on desktop build :D
static void mario_die();
{
//if(memory<10 && function_finished[mario_die]==0)
//	{
//	kick_my_ass(); }
}
static void game_over();
{
//DONT FORGET TO FINISH THIS FUNCTION!!!!!
//if you are reading this, apparently I forgot, please notify me immediately.
}
static void mario_events(PzEvent *e)
{
e->wid->dirty = 1;
    int ret = TTK_EV_CLICK;
    
	switch(e->type) 
    {
     
	case PZ_EVENT_BUTTON_DOWN:
		switch (e->arg) 
        {
		       case PZ_BUTTON_ACTION:
			        buttondown[0]=1;
				    mrun=1;
					if(mario_state==3 || mario_state==6)
			        {
					   if(t!=2)
					   {
					   fireball_x[t]=mario_x+16;
					   fireball_y[t]=mario_y-16;
					   t++;
					   }
					}	
					break;
		       case PZ_BUTTON_MENU:
			        buttondown[1]=1;
				    mjump=1;
                    break;
        
               case PZ_BUTTON_NEXT:
                    mwalk=1;
                    mdirection=2;
					buttondown[3]=1;
					break;
		  
               case PZ_BUTTON_PREVIOUS:
                    mwalk=1;
                    mdirection=1;
                    buttondown[2]=1;
					break;
               case PZ_BUTTON_PLAY:
                    buttondown[4]=1;
					if(onground==1 && (mario_state==2 || mario_state==3))
					{
					mcrouch=1;
					mario_y=mario_y-12;
					}
					break;
		}
		break;

	case PZ_EVENT_BUTTON_UP:
		switch (e->arg) 
        {
		       case PZ_BUTTON_ACTION:
			        buttondown[0]=0;
				    mrun=0;
					break;
		       case PZ_BUTTON_MENU:
			        buttondown[1]=0;
				    mjump=0;
                    break;
        
               case PZ_BUTTON_NEXT:
                    mwalk=0;
					buttondown[3]=0;
					break;
		  
               case PZ_BUTTON_PREVIOUS:
                    mwalk=0;
                    buttondown[2]=0;
					break;
               case PZ_BUTTON_PLAY:
                    buttondown[4]=0;
					mcrouch=0;
                    break;
		}
		break;
	
	default:
		ret = TTK_EV_UNUSED;
		break;
    }
	return ret;
}

static PzWindow *new_mario_window()
{
	PzWindow *ret;

	ret = pz_new_window(_("Mario"), PZ_WINDOW_NORMAL);
	pz_add_widget(ret, draw_mario, mario_events);

	return pz_finish_window(ret);
}
static void init_mario()
{
	/*Load the images and assign them to a surface. Get their dimensions*/
    
    module = pz_register_module("Mario", NULL);
	pz_menu_add_action("/Extras/Games/Mario", new_ibolo_window);

    small_mario_left[0] = ttk_load_image (pz_module_get_datapath (module, "smallmarioleft.png"));
    ttk_surface_get_dimen (small_mario_left[0], &imgw, &imgh);
    
    small_mario_left[1] = ttk_load_image (pz_module_get_datapath (module, "smallmarioleft2.png"));
    ttk_surface_get_dimen (small_mario_left[1], &imgw, &imgh);
    
	small_mario_right[0] = ttk_load_image (pz_module_get_datapath (module, "smallmarioright.png"));
    ttk_surface_get_dimen (small_mario_right[0], &imgw, &imgh);
    
    small_mario_right[1] = ttk_load_image (pz_module_get_datapath (module, "smallmarioright2.png"));
    ttk_surface_get_dimen (small_mario_right[1], &imgw, &imgh);

    mario_left[0] = ttk_load_image (pz_module_get_datapath (module, "marioleft.png"));
    ttk_surface_get_dimen (mario_left[0], &imgw, &imgh);
    
    mario_left[1] = ttk_load_image (pz_module_get_datapath (module, "marioleft2.png"));
    ttk_surface_get_dimen (mario_left[1], &imgw, &imgh);
   
	mario_left[2] = ttk_load_image (pz_module_get_datapath (module, "marioleft3.png"));
    ttk_surface_get_dimen (mario_left[2], &imgw, &imgh);

	mario_right[0] = ttk_load_image (pz_module_get_datapath (module, "marioright.png"));
    ttk_surface_get_dimen (mario_right[0], &imgw, &imgh);
    
    mario_right[1] = ttk_load_image (pz_module_get_datapath (module, "marioright2.png"));
    ttk_surface_get_dimen (mario_right[1], &imgw, &imgh);
    
	mario_right[2] = ttk_load_image (pz_module_get_datapath (module, "marioright3.png"));
    ttk_surface_get_dimen (mario_right[2], &imgw, &imgh);
	
	mario_crouch_left = ttk_load_image (pz_module_get_datapath (module, "mariocrouchright.png"));
    ttk_surface_get_dimen (mario_crouch_left, &imgw, &imgh);
    
	mario_crouch_right = ttk_load_image (pz_module_get_datapath (module, "mariocrouchleft.png"));
    ttk_surface_get_dimen (mario_crouch_right, &imgw, &imgh);

	flower_mario_left[0] = ttk_load_image (pz_module_get_datapath (module, "flowermarioleft1.png"));
    ttk_surface_get_dimen (flower_mario_left[0], &imgw, &imgh);
    
    flower_mario_left[1] = ttk_load_image (pz_module_get_datapath (module, "flowermarioleft2.png"));
    ttk_surface_get_dimen (flower_mario_left[1], &imgw, &imgh);
   
	flower_mario_left[2] = ttk_load_image (pz_module_get_datapath (module, "flowermarioleft3.png"));
    ttk_surface_get_dimen (flower_mario_left[2], &imgw, &imgh);

	flower_mario_right[0] = ttk_load_image (pz_module_get_datapath (module, "flowermarioright1.png"));
    ttk_surface_get_dimen (flower_mario_right[0], &imgw, &imgh);
    
    flower_mario_right[1] = ttk_load_image (pz_module_get_datapath (module, "flowermarioright2.png"));
    ttk_surface_get_dimen (flower_mario_right[1], &imgw, &imgh);
    
	flower_mario_right[2] = ttk_load_image (pz_module_get_datapath (module, "flowermarioright3.png"));
    ttk_surface_get_dimen (flower_mario_right[2], &imgw, &imgh);


    goomba[0] = ttk_load_image (pz_module_get_datapath (module, "goomba1.png"));
    ttk_surface_get_dimen (goomba[0], &imgw, &imgh);
    
    goomba[1] = ttk_load_image (pz_module_get_datapath (module, "goomba2.png"));
    ttk_surface_get_dimen (goomba[1], &imgw, &imgh);
    
    goomba_squish = ttk_load_image (pz_module_get_datapath (module, "goomba_squished.png"));
    ttk_surface_get_dimen (goomba_squish, &imgw, &imgh);
    
    gkoopa_l[0] = ttk_load_image (pz_module_get_datapath (module, "greenkoopaleft.png"));
    ttk_surface_get_dimen (gkoopa_l[0], &imgw, &imgh);
    
    gkoopa_l[1] = ttk_load_image (pz_module_get_datapath (module, "greenkoopaleft2.png"));
    ttk_surface_get_dimen (gkoopa_r[1], &imgw, &imgh);

	gkoopa_r[0] = ttk_load_image (pz_module_get_datapath (module, "greenkooparight.png"));
    ttk_surface_get_dimen (gkoopa_r[0], &imgw, &imgh);
    
    gkoopa_r[1] = ttk_load_image (pz_module_get_datapath (module, "greenkooparight2.png"));
    ttk_surface_get_dimen (gkoopa_r[1], &imgw, &imgh);

    rkoopa_l[0] = ttk_load_image (pz_module_get_datapath (module, "redkoopaleft.png"));
    ttk_surface_get_dimen (rkoopa_l[0], &imgw, &imgh);
    
    rkoopa_l[1] = ttk_load_image (pz_module_get_datapath (module, "redkoopaleft2.png"));
    ttk_surface_get_dimen (rkoopa_r[1], &imgw, &imgh);

	rkoopa_r[0] = ttk_load_image (pz_module_get_datapath (module, "redkooparight.png"));
    ttk_surface_get_dimen (rkoopa_r[0], &imgw, &imgh);
    
    rkoopa_r[1] = ttk_load_image (pz_module_get_datapath (module, "redkooparight2.png"));
    ttk_surface_get_dimen (rkoopa_r[1], &imgw, &imgh);

	
	greenshell[0] = ttk_load_image (pz_module_get_datapath (module, "greenshell1.png"));
    ttk_surface_get_dimen (greenshell[0], &imgw, &imgh);

	greenshell[1] = ttk_load_image (pz_module_get_datapath (module, "greenshell2.png"));
    ttk_surface_get_dimen (greenshell[1], &imgw, &imgh);

	greenshell[2] = ttk_load_image (pz_module_get_datapath (module, "greenshell3.png"));
    ttk_surface_get_dimen (greenshell[2], &imgw, &imgh);

	greenshell[3] = ttk_load_image (pz_module_get_datapath (module, "greenshell4.png"));
    ttk_surface_get_dimen (greenshell[3], &imgw, &imgh);
	
	redshell[0] = ttk_load_image (pz_module_get_datapath (module, "redshell1.png"));
    ttk_surface_get_dimen (redshell[0], &imgw, &imgh);

	redshell[1] = ttk_load_image (pz_module_get_datapath (module, "redshell2.png"));
    ttk_surface_get_dimen (redshell[1], &imgw, &imgh);

	redshell[2] = ttk_load_image (pz_module_get_datapath (module, "redshell3.png"));
    ttk_surface_get_dimen (redshell[2], &imgw, &imgh);

	redshell[3] = ttk_load_image (pz_module_get_datapath (module, "redshell4.png"));
    ttk_surface_get_dimen (redshell[3], &imgw, &imgh);


    ground = ttk_load_image (pz_module_get_datapath (module, "brick.png"));
    ttk_surface_get_dimen (ground, &imgw, &imgh);
    
    block = ttk_load_image (pz_module_get_datapath (module, "block.png"));
    ttk_surface_get_dimen (block, &imgw, &imgh);
    
    qblock[0] = ttk_load_image (pz_module_get_datapath (module, "qblock1.png"));
    ttk_surface_get_dimen (qblock[0], &imgw, &imgh);
    
    qblock[1] = ttk_load_image (pz_module_get_datapath (module, "qblock2.png"));
    ttk_surface_get_dimen (qblock[1], &imgw, &imgh);
    
    qblock[2] = ttk_load_image (pz_module_get_datapath (module, "qblock3.png"));
    ttk_surface_get_dimen (qblock[2], &imgw, &imgh);
    
    qblock[3] = ttk_load_image (pz_module_get_datapath (module, "qblock4.png"));
    ttk_surface_get_dimen (qblock[3], &imgw, &imgh);
    
	usedblock = ttk_load_image (pz_module_get_datapath (module, "usedblock.png"));
    ttk_surface_get_dimen (usedblock, &imgw, &imgh);

    coin[0] = ttk_load_image (pz_module_get_datapath (module, "coin.png"));
    ttk_surface_get_dimen (coin[0], &imgw, &imgh);
    
    coin[1] = ttk_load_image (pz_module_get_datapath (module, "coin2.png"));
    ttk_surface_get_dimen (coin[1], &imgw, &imgh);
    
    coin[2] = ttk_load_image (pz_module_get_datapath (module, "coin3.png"));
    ttk_surface_get_dimen (coin[2], &imgw, &imgh);
    
    coin[3] = ttk_load_image (pz_module_get_datapath (module, "coin4.png"));
    ttk_surface_get_dimen (coin[3], &imgw, &imgh);
    
    mushroom = ttk_load_image (pz_module_get_datapath (module, "mushroom.png"));
    ttk_surface_get_dimen (mushroom, &imgw, &imgh);
    
    1up = ttk_load_image (pz_module_get_datapath (module, "1up.png"));
    ttk_surface_get_dimen (1up, &imgw, &imgh);
    
    flower = ttk_load_image (pz_module_get_datapath (module, "flower.png"));
    ttk_surface_get_dimen (flower, &imgw, &imgh);
    
    fireball[0] = ttk_load_image (pz_module_get_datapath (module, "fireball1.png"));
    ttk_surface_get_dimen (fireball[0], &imgw, &imgh);
    
    fireball[1] = ttk_load_image (pz_module_get_datapath (module, "fireball2.png"));
    ttk_surface_get_dimen (fireball[1], &imgw, &imgh);
    
    fireball[2] = ttk_load_image (pz_module_get_datapath (module, "fireball3.png"));
    ttk_surface_get_dimen (fireball[2], &imgw, &imgh);
    
    fireball[3] = ttk_load_image (pz_module_get_datapath (module, "fireball4.png"));
    ttk_surface_get_dimen (fireball[3], &imgw, &imgh);
    
    star[0] = ttk_load_image (pz_module_get_datapath (module, "star1.png"));
    ttk_surface_get_dimen (star[0], &imgw, &imgh);
    
    star[1] = ttk_load_image (pz_module_get_datapath (module, "star2.png"));
    ttk_surface_get_dimen (star[1], &imgw, &imgh);

    star[2] = ttk_load_image (pz_module_get_datapath (module, "star3.png"));
    ttk_surface_get_dimen (star[2], &imgw, &imgh);
    
    star[3] = ttk_load_image (pz_module_get_datapath (module, "star4.png"));
    ttk_surface_get_dimen (star[3], &imgw, &imgh);    

	win = ttk_load_image (pz_module_get_datapath (module, "win1.png"));
    ttk_surface_get_dimen (win, &imgw, &imgh);  
}

PZ_MOD_INIT(init_mario)