questions

Game Editor comments and discussion.

questions

Postby Fojam » Sat Jan 22, 2011 7:29 pm

1.) I am not quite sure how to explain this, but i want to be able to make level packs for my games, and have each level pack to have a custom icon.
I want to create an executable file and never have to edit it, just make level packs for it.
I have already layed out 100 possible levels with the path of where I would put the level pack (ex: when i click on level 1, it will open /levels/level1/level1.dat)
I want when I mouse over a level to select it, the icon in the levels folder will popup on the left, without having to include that icon in the original executable. If that level hasn't been added to the levels folder yet, the icon will simply say unavailable.

I know its kind of confusing what im saying but i couldnt think of an easier way to put that

2.) is there a variable or function that detirmines whether a certain file exists? for example:
if filedoesntexist;
{
information.textNumber=file unavailable
}

not exactly like that but you get my point

3.) is it possible to only allow an actor to move along the x coordinate or only move along the y coordinate, even when the mouse is dragging the actor?
CLICK TO GIVE ME POINTS

My Latest Projects:
Super Smash Bros: viewtopic.php?f=6&t=12307 PLEASE help by making sprites!
User avatar
Fojam
 
Posts: 513
Joined: Thu Mar 19, 2009 10:02 pm
Location: under your bed!!!
Score: 69 Give a positive score

Re: questions

Postby Game A Gogo » Sat Jan 22, 2011 8:10 pm

2)
Code: Select all
if(fopen(FILENAME,"r+b")==NULL)
{
     //action;
}

3) don't use Mouse Button -> Drag.

do this instead, create a variable called MouseB, make it equal 1 on mouse button down and 0 on mouse up. in draw actor do this:
Code: Select all
if(MouseB)x=max(-50,min(xmouse-parent.xscreen,50));

NOTE: Make the slider parent to the Background of the slider, this code is for 0 to 100, so the slider will go from -50 to 50 from it's parent actor, no matter where it is. To get a value from the slide is also easy:
Code: Select all
textNumber=SliderFG.x+50;
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: questions

Postby Fojam » Sat Jan 22, 2011 8:13 pm

thank you so much
CLICK TO GIVE ME POINTS

My Latest Projects:
Super Smash Bros: viewtopic.php?f=6&t=12307 PLEASE help by making sprites!
User avatar
Fojam
 
Posts: 513
Joined: Thu Mar 19, 2009 10:02 pm
Location: under your bed!!!
Score: 69 Give a positive score

Re: questions

Postby Game A Gogo » Sat Jan 22, 2011 8:16 pm

To have custom icons, you'll need to load an external bitmap with a bitmap loading function, heres one I made:
Code: Select all
short int BG_BMP[1024][1024][4],BGImgBPP;
int BGImgW,BGImgH;
void ImpBmp(char*dir)
{
    int BmpHeader[64], i,j;
    FILE*TBMP=fopen(dir, "r+b");
    for(i=0; i<64; i++)
    {
        BmpHeader[i]=fgetc(TBMP);
    }
    if(BmpHeader[0]==66 && BmpHeader[1]==77)//Checks if this really is a bmp!
    {
        BGImgW=BmpHeader[18]+BmpHeader[19]*256;
        BGImgH=BmpHeader[22]+BmpHeader[23]*256;
        BGImgBPP=BmpHeader[28];
        fseek(TBMP, BmpHeader[10], SEEK_SET);
        for(i=BGImgH-1; i>=0; i--)
        {
            for(j=0; j<BGImgW; j++)
            {
                BG_BMP[j][i][0]=fgetc(TBMP);
                BG_BMP[j][i][1]=fgetc(TBMP);
                BG_BMP[j][i][2]=fgetc(TBMP);
                if(BGImgBPP==32){BG_BMP[j][i][3]=fgetc(TBMP);fseek(TBMP, BGImgW%4, SEEK_CUR);}
                else fseek(TBMP, BGImgW%4, SEEK_CUR);
            }
        }
    }
fclose(TBMP);
}

it works for 24-bit and 32-bit bitmaps and can load a file from 1x1 to 1024x1024, any size (402x395 would work)
Just access BGImgW and BGImgH for width and height
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: questions

Postby Fojam » Sat Jan 22, 2011 8:21 pm

i replace FILE with the bitmaps path, right? but what do i replace TBMP and what else do i have to replace?
Last edited by Fojam on Sat Jan 22, 2011 8:26 pm, edited 2 times in total.
CLICK TO GIVE ME POINTS

My Latest Projects:
Super Smash Bros: viewtopic.php?f=6&t=12307 PLEASE help by making sprites!
User avatar
Fojam
 
Posts: 513
Joined: Thu Mar 19, 2009 10:02 pm
Location: under your bed!!!
Score: 69 Give a positive score

Re: questions

Postby Game A Gogo » Sat Jan 22, 2011 8:25 pm

Nothing needs to be replaced! unless you want to change the BG_BMP name :P
you'll use the function like this:
Code: Select all
ImpBmp("Image.bmp");
goes in a create actor, if you want a way to display the bitmap here:
Code: Select all
void DrawBmp()
{
    int i,j;
    for(i=0;i<BGImgW;i++)
    {
        for(j=0;j<BGImgH;j++)
        {
            setpen(BG_BMP[i][j][2],BG_BMP[i][j][1],BG_BMP[i][j][0],0,1);
            putpixel(i,j);
        }
    }
}
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: questions

Postby Fojam » Sat Jan 22, 2011 8:27 pm

ok that works but when i do the scroll code, it just goes becck to its original position every time i click on it.
the slider i am using is set as y infinite if that is what is affecting it
CLICK TO GIVE ME POINTS

My Latest Projects:
Super Smash Bros: viewtopic.php?f=6&t=12307 PLEASE help by making sprites!
User avatar
Fojam
 
Posts: 513
Joined: Thu Mar 19, 2009 10:02 pm
Location: under your bed!!!
Score: 69 Give a positive score

Re: questions

Postby Game A Gogo » Sat Jan 22, 2011 8:28 pm

want a simple almost-no cpu costing way to resize the icon?
Code: Select all
void DrawBmp(double Size)
{
    int i,j;
    for(i=0;i<BGImgW;i++)
    {
        for(j=0;j<BGImgH;j++)
        {
            setpen(BG_BMP[i][j][2],BG_BMP[i][j][1],BG_BMP[i][j][0],0,Size);
            putpixel(i*Size,j*Size);
        }
    }
}
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: questions

Postby Game A Gogo » Sat Jan 22, 2011 8:29 pm

Fojam wrote:ok that works but when i do the scroll code, it just goes becck to its original position every time i click on it.
the slider i am using is set as y infinite if that is what is affecting it

This is not suppose to happen... are you sure it's parented to it's Background? since it uses it's parent as a point of origination. You can always have a variable name "IntXP" on create actor it would be:
Code: Select all
IntXP=xscreen;
and instead of parent.xscreen you'd use IntXP. This would require no parent
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: questions

Postby Fojam » Sat Jan 22, 2011 8:35 pm

its not parent issue. Ive uploaded the file so you can see what I mean
Attachments
game.zip
(436.04 KiB) Downloaded 80 times
CLICK TO GIVE ME POINTS

My Latest Projects:
Super Smash Bros: viewtopic.php?f=6&t=12307 PLEASE help by making sprites!
User avatar
Fojam
 
Posts: 513
Joined: Thu Mar 19, 2009 10:02 pm
Location: under your bed!!!
Score: 69 Give a positive score

Re: questions

Postby Game A Gogo » Sat Jan 22, 2011 8:38 pm

oh, should of told me it was that kind of slider, simply add
Code: Select all
IntYP=yscreen;
on mouse button up, my first exemple (with parent) shouldn't work for this

EDIT: Nvm this seem to not work, I'll get back to you when I have something :P
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: questions

Postby Fojam » Sat Jan 22, 2011 8:43 pm

ok just PM me then

thanks for everything else
CLICK TO GIVE ME POINTS

My Latest Projects:
Super Smash Bros: viewtopic.php?f=6&t=12307 PLEASE help by making sprites!
User avatar
Fojam
 
Posts: 513
Joined: Thu Mar 19, 2009 10:02 pm
Location: under your bed!!!
Score: 69 Give a positive score

Re: questions

Postby Game A Gogo » Sat Jan 22, 2011 8:46 pm

why PM? let the others harvest from this :)
ok, remove the create actor event (if you have one), and remove the IntYP variable (if you had it) and create mouseS and put this in draw actor:
Code: Select all
if(MouseB)y+=ymouse-mouseS;
mouseS=ymouse;

on mouse button down add:
Code: Select all
mouseS=ymouse;


I tested it, this should work :)
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: questions

Postby Fojam » Sat Jan 22, 2011 8:59 pm

works perfectly thanks!
CLICK TO GIVE ME POINTS

My Latest Projects:
Super Smash Bros: viewtopic.php?f=6&t=12307 PLEASE help by making sprites!
User avatar
Fojam
 
Posts: 513
Joined: Thu Mar 19, 2009 10:02 pm
Location: under your bed!!!
Score: 69 Give a positive score

Re: questions

Postby Game A Gogo » Sat Jan 22, 2011 9:03 pm

great! :)
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Next

Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron