ok, I was able to figure out how to do it. Ill post the program on here incase anyone has trouble doing it too.
#include <acknex.h>
int v, h, k, p, w, enemy_pos_x, bullet_pos_y;
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;
}
void run_bullet()
{
PANEL *mybullet = pan_create( "bmap=missile2.bmp; flags=VISIBLE | OVERLAY; pos_y = 130;", 11);
mybullet.pos_x = v+15;
{
while( mybullet->pos_y < screen_size.y )
{
mybullet->pos_y += 15 * time_step;
if((mybullet.pos_y > 300)&&(mybullet.pos_y < 400)&&(mybullet.pos_x > (w-100))&&(mybullet.pos_x < (w+100)))
{
printf("Hit");
}
wait(1);
}
}
}
void run_enemy()
{
PANEL *myenemy = pan_create( "bmap=ship3.bmp; flags=VISIBLE | OVERLAY; pos_y = 350; pos_x = 790;", 11);
{
while( myenemy->pos_x < screen_size.x )
{
myenemy->pos_x -= 4 * time_step;
wait(1);
w= myenemy.pos_x;
}
}
}
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;
}
}
#define USER 1
var mode_player = USER;
function main ()
{
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 (create_counter%600 == 0)
{
run_enemy();
enemy_count++; //
}
if (key_v)
{
if (create_counter%100 == 0)
{
run_bullet();
}
}
else if (key_esc) { sys_exit(NULL); }
}
}
Thanks again for taking the time to help me =].
DG