process refuses to be killed

Started by MisterN, October 14, 2012, 04:38:13 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MisterN

In the enemy code, there is this:
//being attacked
        if(procID = collision(type bullet_1))
            say(procID);
            signal(procID,s_kill);
            boss_a.health--;
            procID = 0;
        end

It is taking away health, but it is not destroying the bullet, so the bullet will take away alot of damage. I tried s_kill_force, but that did not work either. How can this be easily fixed? Thanks
werg

handsource-dyko

In your code you kill the process before you subtract the health. Signals (especially a kill signal) have an inmediate effect.
Try swapping the two statements, the kill signal should be the last statement in the sequence.

SplinterGU

man, you already must know that a segment of a code don't is usefull for get a help.
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

SplinterGU

Quote from: handsource-dyko on October 14, 2012, 04:56:39 PM
In your code you kill the process before you subtract the health. Signals (especially a kill signal) have an inmediate effect.
Try swapping the two statements, the kill signal should be the last statement in the sequence.


no, you wrong... signal is to prodID, health is to boss_a... don't mather the order...
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

MisterN

Quote from: SplinterGU on October 14, 2012, 05:45:39 PM
man, you already must know that a segment of a code don't is usefull for get a help.

well its as simple as that. the test process literally is:


process text_bullet(x,y)
private
int procID;
begin
file = test_boss_fpg;
graph = 1;
write(0,240,224,0,"Health:"); write_var(0,290,224,0,boss_a.health);
    loop
        //being attacked
        if(procID = collision(type bullet_1))
            say(procID);
            boss_a.health--;
            signal(procID,s_kill);
            procID=0;
        end
    frame;end
end


boss_a.health being 100 by the way. text_boss_fpg is literally just cutman from megaman.
werg

SplinterGU

where is the main? the boss process... I can't compile and test your code...

you already made lot of support request, you already must know that we need provide a full test code with the problem.
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

MisterN

the code im testing the bullet with is a test program since theres too much to do in my main engine, but all the mechanics are the same. change text_bullet to test_bullet

make this the struct.prg (although most of it wont be used)

struct boss_a
    //Transparency (0 - invisible, 100 - fully visible)
        byte alpha = 100;
    //Information
        int x;
        int y;
        byte dimx = 32;
        byte dimy = 32;
        byte health = 100;
        int summon_time = 180;
    //Movement
        byte walk_speed = 1;           
        byte fall_speed = 2;
        byte jump_speed = 2;
    //Status
        bool jumping = false; //if its jumping in the air
        bool falling = false;
        bool on_ground = true; //when on the ground, before summoning the rock
        bool is_left = true; //direction being faced
    //Animation
        byte i = 2;
        byte animation_timer = 9;
        byte time = 1;
    //Weapon
        bool in_hand = false; //when on the ground, after summoning the rock
        bool has_thrown = false; //has thrown the rock
        int charge_time = 180; //the time it takes from when the rock is being held to it being thrown
end


make this main.prg


#ifndef __VERSION__
    import "mod_sdlevthandler";
    import "mod_pathfind";
#else
    import "mod_blendop";
    import "mod_text";
    import "mod_grproc";
    import "mod_video";
    import "mod_map";
    import "mod_screen";
    import "mod_path";
    import "mod_rand";
    import "mod_say";
    import "mod_mouse";
    import "mod_scroll";
    import "mod_math";
#endif

IMPORT "mod_debug";
IMPORT "mod_dir";
IMPORT "mod_file";
IMPORT "mod_key";
IMPORT "mod_draw";
IMPORT "mod_string";
IMPORT "mod_proc";
IMPORT "mod_wm";
IMPORT "mod_sys";
IMPORT "mod_joy";
IMPORT "mod_sound";
IMPORT "mod_time";
IMPORT "mod_timers";
IMPORT "mod_cd"

global
INLUCDE"struct.prg";

byte test_boss_fpg;

byte bullet_time = 180; //ever three seconds a shot is fired

process main()
begin
    //Sets the default resolution of 320x240
    set_mode(320,240,16);
    //Sets the fps to 60 frames per second
    set_fps(60,0);

    test_boss_fpg = load_fpg("test_boss.fpg");

    test_bullet(272,192);

    loop
        if(bullet_time>0)
            bullet_time--;
        else
            bullet_1(48,200);
            bullet_time=180;
        end

        ///end game
        IF (key(_esc) or exit_status)
            exit("goodbye!",0);
        END
    frame;end

end

#INCLUDE "bullet.prg"
#INCLUDE "test_bullet.prg"



make this the bullet.prg (test_bullet.prg is the boss)


process bullet_1(x,y)
private
begin
file = load_fpg("weps.fpg");
graph = 1;
    loop
        x++;
    frame;end
end

NOTE: my control key doesn't work nor does my right click so I had to type this up again
werg

SplinterGU

#7

splinter@splinter:~/tmp/x> bgdc
bullet.prg    main.prg      struct.prg    testboss.fpg  weps.fpg     
splinter@splinter:~/tmp/x> bgdc main.prg
BGDC 1.0.0 (Oct  6 2012 19:16:55)
Bennu Game Development Compiler

Copyright (c) 2006-2012 SplinterGU (Fenix/BennuGD)
Copyright (c) 2002-2006 Fenix Team (Fenix)
Copyright (c) 1999-2002 Jos� Luis Cebri�n Pag�e (Fenix)

/home/splinter/tmp/x/main.prg:35: error: ";" expected ( token error: "struct.prg" ).


please, compilable code... and please, attach all package in a zip.

thanks...
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

SplinterGU

oh, man, please, you have a serious problem in your method... you use INLUCDE instead of INCLUDE, you use load of fpg named test_boss.fpg but you real fpg is named testboss.fpg...

man, have more careful about what you write.
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

SplinterGU

I fix all problem in your code (load_fpg, and right include) and it works excelent... bullet is killed.

man, take care about your write.

I think that you are compiling but compile give you an error, and you don't check the compiler output... then you are testing old dcb.
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

handsource-dyko

Quote from: SplinterGU on October 15, 2012, 12:57:11 AM
I fix all problem in your code (load_fpg, and right include) and it works excelent... bullet is killed.

man, take care about your write.

I think that you are compiling but compile give you an error, and you don't check the compiler output... then you are testing old dcb.

Exactly, I've had this a few times too but got aware of this by my own experience. I often pipe the compiler output to a text file and check the last few lines for error messages. This way I prevent situations like this.... ;D

MisterN

Quote from: SplinterGU on October 15, 2012, 12:55:00 AM
man, have more careful about what you write.

im sorry, i had to re-type it word for word so i messed up a couple of things.

could you post the corrected code?
werg

SplinterGU

sorry, I was delete all them... you can fix them following my comments...
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

MisterN

#13
well if its any typo error there are none in the real thing. remember, i had to retype it word for word since my control key and right click dont work. And you can't say im testing an older .dcb file because when i make changes i use say();
werg

SplinterGU

then, I don't know, here works...

anybody else can test it?
Download Lastest BennuGD Release: http://www.bennugd.org/node/2