converting the 2D side scroller tut to Lite-C

Posted By: OblivionDrake

converting the 2D side scroller tut to Lite-C - 12/22/08 23:26

Hello I'm trying to do the 2D side scroller from the AU resoures page but in Lite-C and I keep getting and error in my code.

#include <acknex.h>
#include <default.c>

BMAP* fond_pcx="fond.pcx";

PANAL* fond_pan = ////////This is were it says theres an error
{
pos_x=0;
pos_y=0;
layer=0;
bmap=fond_pcx
flags = OVERLAY | VISIBLE;
}

function main()
{
video_mode = 7;
screen_color.blue = 150;
}

I'v been jumping back and forth between this tutorial and the Lite-C workshop and am at a lose as to whats wrong with that particular line.

my only thought is if there isn't anything wrong with the script then it mint be the sprites since I cant view them unless I agree to some EULA license and if thats the case can anyone tell me whats on the each picture so I can make my own form of the sprites.
Posted By: TechMuc

Re: converting the 2D side scroller tut to Lite-C - 12/22/08 23:46

correct is PANEL*
and not PANAL

see english dictionary --> panel :p
Posted By: OblivionDrake

Re: converting the 2D side scroller tut to Lite-C - 12/23/08 00:08

Thanks TechMuc I sometimes over look little things like that but now I get an error here:

#include <acknex.h>
#include <default.c>

BMAP* fond_pcx="fond.pcx";

PANEL* fond_pan=
{
pos_x=0;
pos_y=0;
layer=0;
bmap=fond_pcx //////////////In these two lines
flags = OVERLAY | VISIBLE;//
}

function main()
{
video_mode = 7;
screen_color.blue = 150;
}

the message sayes ():too many parameters flags
():Syntax error

anyone know whats wrong there?
Posted By: Blade280891

Re: converting the 2D side scroller tut to Lite-C - 12/23/08 00:09

try adding a semicolon to the end of fond_pcx
Posted By: OblivionDrake

Re: converting the 2D side scroller tut to Lite-C - 12/23/08 00:36

Yes Blade28081991 you are my hero!!!!
Like I mentioned to TechMuc its always the little thing that get me.

again thanks

ill most likely post the finished code here that is unless I have anyother problems.
Posted By: OblivionDrake

Re: converting the 2D side scroller tut to Lite-C - 12/23/08 02:36

Back and with more than one problem now but not because of a little miss step more because of my lack of Lite-C knowledge. My next major task is to creat a sky panel that moves and has the bmap refresh so it makes the illuion of a neverending sky as the player moves.

Now Ive followed the instructions by creating a second panel using the same sky bmap and but it directly beside the other. But in doing this I had to change some things and one thing which Im not so sure I replaced it with the right thing.In this code:

panel scroll_ciel_pan
{
pos_x = 0; pos_y = 0;
layer = 1;
bmap = ciel_map;
flags = refresh;///////refresh isnt anything in Lite-C
}

so I replaced it with OVERLAY | VISIBLE which alows it to show up but im not shure thats all that the refresh statment in C-script did. So my question is Is what I replaced refresh with alright or was there something else I should have replace it with?

The other thing is that I moved on and am at this step were I add this function

function avance_ciel()
{
ciel_pos +=1; ////////////////but theres a problem with this line
if (ciel_pos >= 640){ciel_pos = 0;}
}

And Im not sure how to fix it or if theres anything else wrong with this function that needs to be updated to Lite-C.
Posted By: Ottawa

Re: converting the 2D side scroller tut to Lite-C - 12/23/08 23:35

Hi!
panel scroll_ciel_pan

should be

PANEL* scroll_ciel_pan

Hope this helps

Ottawa smile
Posted By: OblivionDrake

Re: converting the 2D side scroller tut to Lite-C - 12/24/08 00:04

Thanks for the reply but I was more conserned about the parts of the script that I made comments by.
Posted By: OblivionDrake

Re: converting the 2D side scroller tut to Lite-C - 12/24/08 21:35

Just to clarify what Im asking since in the original C-script tutorial the comments in there code all of a sudden on page 19 change into a different langue and I had to do a couple more panels before I was told that the code in question with the ciel_pos +=1; posted above. Is soposible a movement code to make a scrolling sky and that is were Im stuck cause I cant figure out what I need to change in that line to make it Lite-C.

Also after looking though the manual that flag = refresh; must of been done away with a wile ago since I couldn't even find it under any section so I guess Im just gona keep using OVERLAY | VISIBLE until it bites me in the ass.

help would be nice.
Posted By: OblivionDrake

Re: converting the 2D side scroller tut to Lite-C - 12/24/08 22:17

Update on how far I am into this but I still have the same problems with the sky scrolling and now since I just continued on in the Tutorial the scrolling mountains since they use the same formula. The places betten the long comment lines is were I need help.

#include <acknex.h>
#include <default.c>

var mont_pos = 0;

BMAP* mont_pcx="mont.pcx";///mountians
BMAP* ciel_pcx="ciel.pcx";///sprite of sky
BMAP* fond_pcx="fond.pcx";///black nothing sprite
PANEL* fond_pan=/////black nothing sprite not even really needed but its still in the C-script tutorial
{
pos_x=0;
pos_y=0;
layer=0;
bmap=fond_pcx;
flags = OVERLAY | VISIBLE;
}
PANEL* ciel_pan=///sky sprite location
{
pos_x=0;
pos_y=0;
layer=1;
bmap=ciel_pcx;
flags = OVERLAY | VISIBLE;
}
PANEL* scroll_ciel_pan=///sky sprite reused with new location
{
pos_x = 640; pos_y = 0;
layer = 1;
bmap = ciel_pcx;
flags = OVERLAY | VISIBLE;
}
PANEL* mont_pan=////mountain sprites location
{
pos_x = 0;pos_y = 35;
layer = 2;
bmap mont_map;
flags = OVERLAY | VISIBLE;
}
PANEL* scroll_mont_pan=
{
pos_x = 0;pos_y = 35;
layer = 2;
bmap mont_map;
flags = OVERLAY | VISIBLE;
}//////////////////////////////////////////////////////////////////////////////
function avance_ciel()////sky scrolling function
{
ciel_pos +=1*time_step;
if (ciel_pos >= 640){ciel_pos = 0;}
}
function deplace()////////Mountain scrolling function
{
if (key_cur == 1)
{
ciel_pos += 1*time_step;
if (ciel_pos >= 640){ciel_pos = 0;}
mont_pos += 3;
if (mont_pos >= 640){mont_pos = 0;}
}
if (KEY_CUL == 1)
{
ciel_pos -= 1*time_step;
if (ciel_pos <= 0){ciel_pos = 640;}
mont_pos -= 3;
if (mont_pos <= 0){mont_pos = 640;}
}
}
//////////////////////////////////////////////////////////////////////////////
function main()
{
video_mode = 7;
while(1)
{
ciel_pcx.pos_x = 0 - ciel_pos;
scroll_ciel_pan.pos_x = 640 - ciel_pos;
mont_pan.pos_x = - mont_pos;
scroll_mont_pan.pos_x = 640 - mont_pos;
avance_ciel();
deplace();
wait(1);
}
}
Posted By: Ottawa

Re: converting the 2D side scroller tut to Lite-C - 12/25/08 00:20

Hi!

var ciel_pos = 0 ; //must be declared before use
//
KEY_CUL should be key_cul ...Lite-C is case sensitive
//
// you have defined ciel_pcx as a bmap in a panel
// you then have to use the panel name ...not the bmap
// so ciel_pcx.pos_x is ciel_pan.pos_x

edit
also
bmap mont_map;
should be bmap = mont_map; //in 2 places
and you have to declare this bmap at the top
BMAP* mont_map = " "; //use your picture pcx
Posted By: OblivionDrake

Re: converting the 2D side scroller tut to Lite-C - 12/27/08 01:43

Thanks a bunch Ottawa.
© 2024 lite-C Forums