PDA

View Full Version : PLib - A Platform Game Development Library



wraggster
November 1st, 2008, 22:03
News from GEMISIS (http://forum.palib.info/index.php?topic=6056.0)


PLib
A Platform Game Development Library

PLib is a creation of my own. It is based off of the PALib Wiki platform tutorials and my own code. It has some amazing features:

Character creation
Object Creation
Character Movement
Object Scrolling
Character and object collision
A level drawing function
And more to come...

It was created to help give DS Homebrew Development a jump start, as I feel that there should be more platforming games out there for hand held systems. Currently there is no release, but there is a video demonstrating PLibs abilities as of 11/1/08!


11/1/08
Demonstration Video:

http://www.youtube.com/watch?v=iQlG1QEdORI

Here is the code for the game. that way you can see how easy it is to make it using PLib:


Code:
// Includes
#include <PA9.h> // Include for PA_Lib
#include <stdio.h>
// PAGfxConverter Include
#include "gfx/all_gfx.c"
#include "gfx/all_gfx.h"

// Include for PLib
#include "../PLib.h"

void initmain(void);

int main()
{
initmain();
return 0;
}

void initmain(void)
{
PA_Init(); // Initializes PA_Lib
PA_InitVBL(); // Initializes a standard VBL
GEM_Init_Backs(); //Initialize the background slots
GEM_Init_PLib(); //Initialize PLib

//Set Mario's score to 0
u8 marioscore = 0;

// Some Random text :)
PA_InitText(1, 2);
PA_OutputSimpleText(1, 1, 2, "Mario Says: Hey, Stop Playing!!!");

//Draw the level
GEM_Draw_Level(mario_world, hills, back); //GEM_Draw_Level(Background 1, Background 2, Background 3) Backgrounds must be converted with PAGfx

//Create the Main Character
MCharacter mario(0, 60, 128-32, //MCharacter name(Sprite Number, Sprite X Position, Sprity Y Position,
colmapcoin_Map, 128, true); //Collisionmap name + _Map, level length (Must be divisble by 8), whether to scroll or not in True or False)

//Create a new object
NewObject coin; //NewObject name

//Draw the Main Character
mario.draw(0, 1, //name.draw(Starting frame for movement, Ending frame for movement,
2, 0, (void*)mario_Texture, 32, 32, TEX_16BITS); // Jumping frame, Standing Frame, (void*) + name + _Texture, Sprite X Size, Sprite Y Size, Texture Conversion Type)

//Draw the object
coin.DrawObjectXY(1, 20, 90, (void*)coin_Texture, //name.DrawObjectXY(Sprite Number, Sprite X Position, Sprite Y Position, (void*) + name + _Texture
8, 8, TEX_16BITS); //Sprite X Size, Sprite Y Size, Texture Conversion Type)

// Infinite loop to keep the program running
while (1)
{
//Move the Character
mario.moveCharacter(mario.spriteNumber, Pad.Held.Right, Pad.Newpress.Right, //name.moveCharacter(name.spriteNumber, Pad.Held.Button, Pad.Newpress.Button,
Pad.Held.Left, Pad.Newpress.Left, Pad.Held.A, Pad.Newpress.A); //Pad.Held.Button, Pad.Newpress.Button, Pad.Held.Button, Pad.Newpress.Button)
//Scroll the object
coin.ScrollObject(coin, mario.scrollx, mario.scrolly); //name.ScrollObject(Sprite Number, main character + .scrollx, main character + .scrolly)
//Collision between the Character and an Object
if(GEM_MAINC_OBJ_COL(mario, coin)==1) //GEM_MAINC_OBJ_COL(character name, object name)
{
coin.DeleteObject(1);
marioscore += 1;
}
//Write the current score
PA_OutputText(1, 1, 4, "Score: %d", marioscore);
//Standard PALib function
PA_WaitForVBL();
//Proccess the 3D Sprites
PA_3DProcess();
}
}

--------------------------------------------------------------------------------
I am currently working on: SSBDS or Super Smash Bros. DS

"When someone pulls you on a string, there are two things you can do; cut it, or play tug of war."

WARNING!
This person cannot do graphics to save their life.