Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - miotatsu

Pages: 1 ... 15 16 [17] 18 19 ... 22
241
Computer Projects and Ideas / Re: piworld PC
« on: December 03, 2009, 05:16:39 pm »
it wont mainly be focused on sailing, the majority of the game will take place on land, but piworld in general is very heavily inspired by zelda so you can always expect similarities to a zelda game.
and yes, the pc version is going to be like all games in the series combined into one big game of epicness. i just need to finish a few small features, make some quick test sprites, and create a small starting world and i will release the next demo, it could be anywhere from later tonight to a few days depending on how things go.

242
Computer Projects and Ideas / Re: piworld PC
« on: December 03, 2009, 12:17:51 am »
The PC version will contain a much larger world but it will be based directly off of the calc version's current areas, new features in the PC version will include the ability to sail into the ocean and find new lands, a larger wilderness, and slightly modified areas to allow for a larger map expansion, it will also feature the ability to enter buildings and dungeons, there will be much more story line to the game and it won't be mainly focused on grinding, and it will continue off of the original piworld storyline (which as of now is not officially added into the calc version) and go into what will most likely become "Piworld II" which will most likely be my next calc project after piworld, also: i have decided on using a system where when you reach the side of the map it pauses, scrolls to the next screen and then continues, i currently have area changing working just fine, but i am having a very hard time with how to go about doing the pause&scroll part, right now im scrolling it internally, but i need to update the screen every loop which is easier said then done because of the way my code is set up, i plan on releasing a new demo /very/ soon and i will also post the source code on here again along with it, i would very much appreciate it if someone could help me out a little with the scrolling system (a spot in the credits awaits you ^.^)

243
TI-Nspire / Re: TI-Nspire GB Emulator
« on: December 02, 2009, 10:48:23 pm »
and so the NspireBoy is born....*starts saving up money*
:O

244
Computer Projects and Ideas / Re: piworld PC
« on: November 21, 2009, 04:37:52 pm »
i got this problem fixed, and now am working on getting a demo put together ^.^

245
Computer Projects and Ideas / piworld PC (old)
« on: November 21, 2009, 12:17:53 am »
Piworld PC Demo v0.2 download: http://www.megaupload.com/?d=R20BJLFT
source:
Code: [Select]
#include "SDL/SDL.h"
#include "SDL/SDL_image.h"
#include "SDL/SDL_Mixer.h"
#include <string>
#include <fstream>
#include <sstream>

const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;
const int SCREEN_BPP = 32;

const int FRAMES_PER_SECOND = 20;

const int DOT_WIDTH = 20;
const int DOT_HEIGHT = 20;

const int LEVEL_WIDTH = 1280;
const int LEVEL_HEIGHT = 960;
int AREAX = 190;
int AREAY = 190;

const int TILE_WIDTH = 80;
const int TILE_HEIGHT = 80;
const int TOTAL_TILES = 192;
const int TILE_SPRITES = 12;

const int TILE_00 = 0;
const int TILE_01 = 1;
const int TILE_02 = 2;
const int TILE_03 = 3;
const int TILE_04 = 4;
const int TILE_05 = 5;
const int TILE_06 = 6;
const int TILE_07 = 7;
const int TILE_08 = 8;
const int TILE_09 = 9;
const int TILE_10 = 10;
const int TILE_11 = 11;

SDL_Surface *dot = NULL;
SDL_Surface *screen = NULL;
SDL_Surface *tileSheet = NULL;

SDL_Rect clips[ TILE_SPRITES ];

SDL_Event event;

SDL_Rect camera = { 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT };

Mix_Music *music = NULL;

class Tile
{
    private:
    SDL_Rect box;

    int type;

    public:
    Tile( int x, int y, int tileType );

    void show();

    int get_type();

    SDL_Rect get_box();
};

class Dot
{
    private:
    SDL_Rect box;

    int xVel, yVel;

    public:
    Dot();

    void handle_input();

    void move( Tile *tiles[] );

    void show();

    void set_camera();
};

class Timer
{
    private:
    int startTicks;

    int pausedTicks;

    bool paused;
    bool started;

    public:
    Timer();

    void start();
    void stop();
    void pause();
    void unpause();

    int get_ticks();

    bool is_started();
    bool is_paused();
};

SDL_Surface *load_image( std::string filename )
{
    SDL_Surface* loadedImage = NULL;

    SDL_Surface* optimizedImage = NULL;

    loadedImage = IMG_Load( filename.c_str() );

    if( loadedImage != NULL )
    {
        optimizedImage = SDL_DisplayFormat( loadedImage );

        SDL_FreeSurface( loadedImage );

        if( optimizedImage != NULL )
        {
            SDL_SetColorKey( optimizedImage, SDL_SRCCOLORKEY, SDL_MapRGB( optimizedImage->format, 0, 0xFF, 0xFF ) );
        }
    }

    return optimizedImage;
}

void apply_surface( int x, int y, SDL_Surface* source, SDL_Surface* destination, SDL_Rect* clip = NULL )
{
    SDL_Rect offset;

    offset.x = x;
    offset.y = y;

    SDL_BlitSurface( source, clip, destination, &offset );
}

bool check_collision( SDL_Rect A, SDL_Rect B )
{
    int leftA, leftB;
    int rightA, rightB;
    int topA, topB;
    int bottomA, bottomB;

    leftA = A.x;
    rightA = A.x + A.w;
    topA = A.y;
    bottomA = A.y + A.h;

    leftB = B.x;
    rightB = B.x + B.w;
    topB = B.y;
    bottomB = B.y + B.h;

    if( bottomA <= topB )
    {
        return false;
    }

    if( topA >= bottomB )
    {
        return false;
    }

    if( rightA <= leftB )
    {
        return false;
    }

    if( leftA >= rightB )
    {
        return false;
    }

    return true;
}

bool init()
{
    if( SDL_Init( SDL_INIT_EVERYTHING ) == -1 )
    {
        return false;
    }

    screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE );

    if( screen == NULL )
    {
        return false;
    }
    
    if( Mix_OpenAudio( 22050, MIX_DEFAULT_FORMAT, 2, 4096 ) == -1 )
    {
        return false;
    }

    return true;
}

bool load_files()
{
    dot = load_image( "Images/dot.png" );

    if( dot == NULL )
    {
        return false;
    }

    tileSheet = load_image( "Images/tiles.png" );

    if( tileSheet == NULL )
    {
        return false;
    }
    
    music = Mix_LoadMUS( "Music/Music1.mp3" );

    if( music == NULL )
    {
        return false;
    }

    return true;
}

void clean_up( Tile *tiles[] )
{
    SDL_FreeSurface( dot );
    SDL_FreeSurface( tileSheet );

    for( int t = 0; t < TOTAL_TILES; t++ )
    {
        delete tiles[ t ];
    }
    
    Mix_FreeMusic( music );

    Mix_CloseAudio();

    SDL_Quit();
}

void clip_tiles()
{
    clips[ TILE_00 ].x = 0;
    clips[ TILE_00 ].y = 0;
    clips[ TILE_00 ].w = TILE_WIDTH;
    clips[ TILE_00 ].h = TILE_HEIGHT;

    clips[ TILE_01 ].x = 0;
    clips[ TILE_01 ].y = 80;
    clips[ TILE_01 ].w = TILE_WIDTH;
    clips[ TILE_01 ].h = TILE_HEIGHT;

    clips[ TILE_02 ].x = 0;
    clips[ TILE_02 ].y = 160;
    clips[ TILE_02 ].w = TILE_WIDTH;
    clips[ TILE_02 ].h = TILE_HEIGHT;

    clips[ TILE_11 ].x = 80;
    clips[ TILE_11 ].y = 0;
    clips[ TILE_11 ].w = TILE_WIDTH;
    clips[ TILE_11 ].h = TILE_HEIGHT;

    clips[ TILE_10 ].x = 80;
    clips[ TILE_10 ].y = 80;
    clips[ TILE_10 ].w = TILE_WIDTH;
    clips[ TILE_10 ].h = TILE_HEIGHT;

    clips[ TILE_09 ].x = 80;
    clips[ TILE_09 ].y = 160;
    clips[ TILE_09 ].w = TILE_WIDTH;
    clips[ TILE_09 ].h = TILE_HEIGHT;

    clips[ TILE_04 ].x = 160;
    clips[ TILE_04 ].y = 0;
    clips[ TILE_04 ].w = TILE_WIDTH;
    clips[ TILE_04 ].h = TILE_HEIGHT;

    clips[ TILE_03 ].x = 160;
    clips[ TILE_03 ].y = 80;
    clips[ TILE_03 ].w = TILE_WIDTH;
    clips[ TILE_03 ].h = TILE_HEIGHT;

    clips[ TILE_08 ].x = 160;
    clips[ TILE_08 ].y = 160;
    clips[ TILE_08 ].w = TILE_WIDTH;
    clips[ TILE_08 ].h = TILE_HEIGHT;

    clips[ TILE_05 ].x = 240;
    clips[ TILE_05 ].y = 0;
    clips[ TILE_05 ].w = TILE_WIDTH;
    clips[ TILE_05 ].h = TILE_HEIGHT;

    clips[ TILE_06 ].x = 240;
    clips[ TILE_06 ].y = 80;
    clips[ TILE_06 ].w = TILE_WIDTH;
    clips[ TILE_06 ].h = TILE_HEIGHT;

    clips[ TILE_07 ].x = 240;
    clips[ TILE_07 ].y = 160;
    clips[ TILE_07 ].w = TILE_WIDTH;
    clips[ TILE_07 ].h = TILE_HEIGHT;
}

bool set_tiles( Tile *tiles[] )
{
    int x = 0, y = 0;

    std::ifstream map( "Maps/MAP1.map" );

    if( map == NULL )
    {
        return false;
    }

    for( int t = 0; t < TOTAL_TILES; t++ )
    {
        int tileType = -1;

        map >> tileType;

        if( map.fail() == true )
        {
            map.close();
            return false;
        }

        if( ( tileType >= 0 ) && ( tileType < TILE_SPRITES ) )
        {
            tiles[ t ] = new Tile( x, y, tileType );
        }
        else
        {
            map.close();
            return false;
        }

        x += TILE_WIDTH;

        if( x >= LEVEL_WIDTH )
        {
            x = 0;

            y += TILE_HEIGHT;
        }
    }

    map.close();

    return true;
}

bool touches_wall( SDL_Rect box, Tile *tiles[] )
{
    for( int t = 0; t < TOTAL_TILES; t++ )
    {
        if( ( tiles[ t ]->get_type() >= TILE_03 ) && ( tiles[ t ]->get_type() <= TILE_11 ) )
        {
            if( check_collision( box, tiles[ t ]->get_box() ) == true )
            {
                return true;
            }
        }
    }

    return false;
}

Tile::Tile( int x, int y, int tileType )
{
    box.x = x;
    box.y = y;

    box.w = TILE_WIDTH;
    box.h = TILE_HEIGHT;

    type = tileType;
}

void Tile::show()
{
    if( check_collision( camera, box ) == true )
    {
        apply_surface( box.x - camera.x, box.y - camera.y, tileSheet, screen, &clips[ type ] );
    }
}

int Tile::get_type()
{
    return type;
}

SDL_Rect Tile::get_box()
{
    return box;
}

Dot::Dot()
{
    box.x = 190;
    box.y = 190;
    box.w = DOT_WIDTH;
    box.h = DOT_HEIGHT;

    xVel = 0;
    yVel = 0;
}

void Dot::handle_input()
{
    if( event.type == SDL_KEYDOWN )
    {
        switch( event.key.keysym.sym )
        {
            case SDLK_UP: yVel -= DOT_HEIGHT / 2; break;
            case SDLK_DOWN: yVel += DOT_HEIGHT / 2; break;
            case SDLK_LEFT: xVel -= DOT_WIDTH / 2; break;
            case SDLK_RIGHT: xVel += DOT_WIDTH / 2; break;
        }
    }
    else if( event.type == SDL_KEYUP )
    {
        switch( event.key.keysym.sym )
        {
            case SDLK_UP: yVel += DOT_HEIGHT / 2; break;
            case SDLK_DOWN: yVel -= DOT_HEIGHT / 2; break;
            case SDLK_LEFT: xVel += DOT_WIDTH / 2; break;
            case SDLK_RIGHT: xVel -= DOT_WIDTH / 2; break;
        }
    }
}

void Dot::move( Tile *tiles[] )
{
    box.x += xVel;
    AREAX += xVel;

    if( ( box.x < 0 ) || ( box.x + DOT_WIDTH > LEVEL_WIDTH ) || touches_wall( box, tiles ) )
    {
        box.x -= xVel;
        AREAX -= xVel;
    }
    
    box.y += yVel;
    AREAY += yVel;

    if( ( box.y < 0 ) || ( box.y + DOT_HEIGHT > LEVEL_HEIGHT ) || touches_wall( box, tiles ) )
    {
        box.y -= yVel;
        AREAY -= yVel;
    }
            
        std::stringstream caption;
        caption << "DEMO " << box.x << "  " << box.y;
        SDL_WM_SetCaption( caption.str().c_str(), NULL );
    
}

void Dot::show()
{
    apply_surface( box.x - camera.x, box.y - camera.y, dot, screen );
}

void Dot::set_camera()
{
    if( ( AREAX >= SCREEN_WIDTH ) && ( box.x < LEVEL_WIDTH ) && ( xVel == 10 ) )
    {
        for( int SCROLL = 0; SCROLL < 650; SCROLL += 10 )
        {
             camera.x = SCROLL;
        }
        AREAX -= SCREEN_WIDTH;
    }
    
    if( ( AREAX <= -15 ) && ( box.x > 0 ) && ( xVel == -10 ) )    
    {
        for( int SCROLL = 650; SCROLL > -10; SCROLL -= 10 )
        {
             camera.x = SCROLL;
        }
        AREAX += SCREEN_WIDTH;
}

if( ( AREAY >= SCREEN_HEIGHT ) && ( box.y < LEVEL_HEIGHT ) && ( yVel == 10 ) )
{
    for( int SCROLL = 0; SCROLL < 490; SCROLL += 10 )
    {
         camera.y = SCROLL;
    }
    AREAY -= SCREEN_HEIGHT;
}

if( ( AREAY <= -15 ) && ( box.y > 0 ) && ( yVel == -10 ) )
{
    for( int SCROLL = 490; SCROLL > -10; SCROLL -= 10 )
    {
         camera.y = SCROLL;
    }
    AREAY += SCREEN_HEIGHT;
}

}

Timer::Timer()
{
    startTicks = 0;
    pausedTicks = 0;
    paused = false;
    started = false;
}

void Timer::start()
{
    started = true;

    paused = false;

    startTicks = SDL_GetTicks();
}

void Timer::stop()
{
    started = false;

    paused = false;
}

void Timer::pause()
{
    if( ( started == true ) && ( paused == false ) )
    {
        paused = true;

        pausedTicks = SDL_GetTicks() - startTicks;
    }
}

void Timer::unpause()
{
    if( paused == true )
    {
        paused = false;

        startTicks = SDL_GetTicks() - pausedTicks;

        pausedTicks = 0;
    }
}

int Timer::get_ticks()
{
    if( started == true )
    {
        if( paused == true )
        {
            return pausedTicks;
        }
        else
        {
            return SDL_GetTicks() - startTicks;
        }
    }

    return 0;
}

bool Timer::is_started()
{
    return started;
}

bool Timer::is_paused()
{
    return paused;
}

int main( int argc, char* args[] )
{
    bool quit = false;

    Dot myDot;

    Tile *tiles[ TOTAL_TILES ];

    Timer fps;

    if( init() == false )
    {
        return 1;
    }

    if( load_files() == false )
    {
        return 1;
    }

    clip_tiles();

    if( set_tiles( tiles ) == false )
    {
        return 1;
    }

    if( Mix_PlayMusic( music, -1 ) == -1 ) { return 1; }

    while( quit == false )
    {
        fps.start();

        while( SDL_PollEvent( &event ) )
        {
            myDot.handle_input();

            if( event.type == SDL_QUIT )
            {
                quit = true;
            }
        }

        myDot.move( tiles );

        myDot.set_camera();
        
        for( int t = 0; t < TOTAL_TILES; t++ )
        {
            tiles[ t ]->show();
        }

        myDot.show();

        if( SDL_Flip( screen ) == -1 )
        {
            return 1;
        }

        if( fps.get_ticks() < 1000 / FRAMES_PER_SECOND )
        {
            SDL_Delay( ( 1000 / FRAMES_PER_SECOND ) - fps.get_ticks() );
        }
        
    }

    clean_up( tiles );

    return 0;
}

246
TI Z80 / Re: piworld
« on: November 18, 2009, 08:59:16 pm »
i will be working on the PC version for a while, so this version will be on hold. I will still finish this version of course tho :)

247
while your at it does anyone know a good music converter, specifically between wav and mp3, i would find that useful but also didnt  have much luck on google D:

248
TI Z80 / Re: Tamagochi
« on: November 10, 2009, 02:05:37 pm »
instead of tamagotchi make it the  (pause for epicness)

THE PORTABLE CHERRY FLAVORED DRAGON  !!!IAMBIAN!!!
This i would play. just dont forget about a Blue Lobster edition xD

249
TI Z80 / Re: piworld
« on: November 09, 2009, 02:12:38 am »
alright, i have a working creature engine but there are still plenty of glitches with it, the glitches are:
1. it gets caught in a subloop
2. occasionally will throw a domain error
3. creature sprites not refreshed if overlapped/walked over

250
Miscellaneous / Re: Birthday Posts
« on: November 04, 2009, 04:59:25 pm »
yay :{D
*noms on the cake*

251
TI Z80 / Re: Interesting...
« on: October 31, 2009, 09:06:54 pm »
this seems like spam to me, but maybe you are just trying to build suspense or something so ill go along with it :{O

252
TI Z80 / Re: ScreenShots and Concept Art
« on: October 28, 2009, 09:13:45 pm »
only time will tell how fast it will run with the ai added, but no, i have yet to fix that bug, im still not even sure the cause of it xd

253
TI Z80 / Re: piworld
« on: October 28, 2009, 08:44:35 pm »
havent been able to be on as much because my sister has been using the comp a lot, i will be getting a laptop soon tho so that will solve that problem, also posted info about my latest update int he screenshots thread.

254
TI Z80 / Re: ScreenShots and Concept Art
« on: October 28, 2009, 08:43:05 pm »
added a screenshot of creatures being loaded, it isnt apperent externally but every creature loaded has individual stats and will all soon have an AI system in place as well, also note that i now have picarc renamed so that all my external stuff can show up at the bottom of the program list :)

255
TI Z80 / Re: piworld
« on: October 18, 2009, 09:45:50 am »
are you asking how long it will take to complete the game/how much content will there be? if thats what your asking then my best answer would be:
the game will stick with 6 to 7 areas, and be very small content wise, its my first ti-basic project, so im trying to keep it small and simple, my next game will be much larger ^.^
for gameplay, it will probably last about a week worth of playing hours every day, not because of a lot of content but because you will need to grind on monsters, if i make an easier mode it will take less time because there wont be as much grinding.

Pages: 1 ... 15 16 [17] 18 19 ... 22