thanks for the help! (sorry i wasn't able to answer right away...been very busy with school =S)
I tried that, but when i run it, an error comes up saying that 'pos_x is not part of BMAP'
i'll post the program i have written so far, and if it wouldnt trouble you too much to take a look at i would really appreciate if you could help me out with it =D
include <acknex.h>
var player_score = 0;
FONT* digital_font = "digital.pcx";
PANEL* main_char=
{
bmap = "enemy_ship1.bmp"; //this is where you write the name of the picture you want for the main character
layer = 11;
pos_x = 0; // x position for the char
pos_y = 100; // y position for the char
flags = SHOW | OVERLAY;
}
function update_player(PANEL *paddle,var paddle_mode,var key) //this function updates the player
{
{
paddle.pos_x += 30*time_step*key;
paddle.pos_x = clamp(paddle.pos_x,0,700);
v = paddle.pos_x;
//printf("%d", v);
}
}
#define USER 1
var mode_player = USER;
BMAP *mybullet = "missile2.bmp";
void run_bullet()
{
PANEL *mypannel = pan_create( "bmap=mybullet; flags=VISIBLE | OVERLAY; pos_y = 130;", 11);
mypannel.pos_x = v+15;
while( mypannel->pos_y < screen_size.y )
{
mypannel->pos_y += 15 * time_step;
wait(1);
}
}
BMAP *myenemy = "ship3.bmp";
void run_enemy()
{
PANEL *mypannel = pan_create( "bmap=myenemy; flags=VISIBLE | OVERLAY; pos_y = 350; pos_x = 790;", 11);
while( mypannel->pos_x < screen_size.x )
{
mypannel->pos_x -= 4 * time_step;
wait(1);
}
}
function main ()
{
//int v;
int enemy_count=0,create_counter=0;
while (enemy_count < 15)
{
update_player(main_char, mode_player, key_d-key_a); // makes d and a the keys to be pressed in order to move the player
wait (1);
create_counter++;
// if (PANEL mybullet.pos_x = PANEL myenemy.pos_x && PANEL mybullet.pos_y = PANEL myenemy.pos_y)
if ((mybullet.pos_x +*/ mybullet.size_x >= myenemy.size_x) || (mybullet.size_x <= /*myenemy.pos_x +*/ myenemy.size_x))
if((mybullet.pos_y +*/ mybullet.size_y >= myenemy.size_y) || (mybullet.size_y <= /*myenemy.pos_y +*/ myenemy.size_y))
{
printf("hit");
}
if (create_counter%600 == 0)
{
run_enemy();
enemy_count++; //
}
if (key_v)
{
if (create_counter%100 == 0)
{
run_bullet();
// run_enemy();
// enemy_count++; //
}
}
else if (key_esc) { sys_exit(NULL); }
}
}
btw thanks for the help so far!