2 registered members (Akow, tomaslolo),
1,536
guests, and 12
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Need help on another program xD
[Re: Redeemer]
#324603
05/22/10 02:49
05/22/10 02:49
|
Joined: Sep 2007
Posts: 268 United States
Doof_Guy
OP
Member
|
OP
Member
Joined: Sep 2007
Posts: 268
United States
|
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!
|
|
|
Re: Need help on another program xD
[Re: Doof_Guy]
#324608
05/22/10 09:06
05/22/10 09:06
|
Joined: Nov 2009
Posts: 89 Germany, NRW
TrackingKeks
Junior Member
|
Junior Member
Joined: Nov 2009
Posts: 89
Germany, NRW
|
BMAP *mybullet = "missile2.bmp";
has to be a PANEL*: PANEL* mybullet = { layer=3; flags=OVERLAY,SHOW; bmap="missile2.bmp"; }
Gamestudio: A7.82 Commercial/A8 Commercial System specs (Laptop): Windows 7 64bit DirectX v10.1 Intel Core i7-720QM CPU @ 1,60 GHz 4GB DDR2 Ram NVIDIA GeForce GT 230M (1024MB)
|
|
|
Re: Need help on another program xD
[Re: TrackingKeks]
#324749
05/23/10 00:20
05/23/10 00:20
|
Joined: Sep 2007
Posts: 268 United States
Doof_Guy
OP
Member
|
OP
Member
Joined: Sep 2007
Posts: 268
United States
|
(edit - ok i think i see where i went wrong, i am going to try to work on that, but i am open to suggestions...=D) (edit 2 - i updated my program, but it still isnt working...im not sure how to globally declare the panel's position...any help on this area will be appreciated) I tried that, but now if messes up my whole program - I will post what i have tho: #include <acknex.h> int v, h, k, p, w; 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); }
}
//function delete_enemy //{ //} #define USER 1
var mode_player = USER;
//PANEL* mybullet = //{ //layer=3; //flags=OVERLAY,SHOW; //bmap="missile2.bmp"; //}
void run_bullet() {
PANEL *mybullet = pan_create( "bmap=missile2.bmp; flags=VISIBLE | OVERLAY; pos_y = 130;", 11); mybullet.pos_x = v+15;
//h = v + 15;
//k = mypanel.pos_y;
while( mybullet->pos_y < screen_size.y ) { mybullet->pos_y += 15 * time_step; wait(1); } }
//PANEL* myenemy = //{ //layer=3; //flags=OVERLAY,SHOW; //bmap="ship3.bmp"; //}
void run_enemy() {
PANEL *myenemy = pan_create( "bmap=ship3.bmp; flags=VISIBLE | OVERLAY; pos_y = 350; pos_x = 790;", 11);
//p = mypanel.pos_x; //w = mypanel.pos_y;
while( myenemy->pos_x < screen_size.x ) { myenemy->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 ((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(); } } else if (key_esc) { sys_exit(NULL); }
} }
thanks for taking the time to help!
Last edited by Doof_Guy; 05/23/10 02:47.
|
|
|
Re: Need help on another program xD
[Re: Doof_Guy]
#325068
05/24/10 19:31
05/24/10 19:31
|
Joined: Sep 2007
Posts: 268 United States
Doof_Guy
OP
Member
|
OP
Member
Joined: Sep 2007
Posts: 268
United States
|
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
|
|
|
|