Hey, a group of friends and me have been trying to program a simple 2d game for a school. I am making the program that will create the bullet at the players location...Problem is, I have been trying to write this code for a few weeks and i keep getting stuck on how to create input the players x_position for where the bullet should be created on the x-axis...if anyone could lend a hand I would be very happy =D.

As you can see when you run the program, the engine will state the value of 'v' before and after creating the bullet, and they will have that value at the correct number...however the engine will only create the bullet at x_position 0

Quote:
#include <acknex.h>
int v;
var player_score = 0;

PANEL* main_char=
{
bmap = "player.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 = "missile.bmp";

void run_bullet()
{

printf("%d", v);
PANEL *mypanel = pan_create( "bmap=mybullet; flags=VISIBLE | OVERLAY; pos_y = 130; pos_x = v;", 11);
printf("%d", v);



while( mypanel->pos_y < screen_size.y )
{
mypanel->pos_y += 15 * time_step;
wait(1);
}

}

function main ()
{
//int v;
int enemy_count;

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);
if (key_v)
{
run_bullet();
enemy_count++; //
wait (200);
}
}

}



thanks for any help given!
DG


To see what 3d models i have made and animated, see the link to my bloghttp://championsdawn.blogspot.com