Bennu Game Development

English Forums => Helpdesk => Topic started by: MisterN on May 29, 2013, 11:48:10 PM

Title: Help with object spawning in the background
Post by: MisterN on May 29, 2013, 11:48:10 PM
Hello, I need some help with the tiled library that is available here:
http://forum.bennugd.org/index.php?topic=3437

The enemy in my game will spawn, but wont be shown every time. Even though I set the z, it still doesnt. Now there may be no correlation with my issue, but I looked in the libraries code, and lines 253 and 374 of api.inc has this:


for (i=0; i<map.layercount; i++)
    layer     = tilemap_layer_scroll(i, map.layers[i], map.tileset,  width,  height);
    layer.x = graphic_info(0, 0, G_WIDTH)/2;
    layer.y = graphic_info(0, 0, G_HEIGHT)/2;
    SCROLL[i].z -= i;
    viewport.layer_scrolls[i] = layer;
end


and I see later on line 253 there is:

z = SCROLL[scroll_id].z;

Do any of you have the slightest idea what the link between these two is? Do you think that by changing this it will correct the issue of the enemy not appearing? I also wonder why the fps is usually 48-50 instead of 60 (it is either my pc or its the game somehow). Please help me.
Thanks
Title: Re:Help with object spawning in the background
Post by: JaViS on May 30, 2013, 12:48:46 PM
Hey I'm very sorry for the super late reply.


What's the z you're giving to your enemy process?



Title: Re:Help with object spawning in the background
Post by: MisterN on May 30, 2013, 02:18:31 PM
look at the code, its -1. Player z is 0 and appears just fine.
Title: Re:Help with object spawning in the background
Post by: JaViS on May 30, 2013, 02:25:07 PM
Then I think it shouldn't be a Z problem. maybe the enemy isn't spawning.
Title: Re:Help with object spawning in the background
Post by: MisterN on May 30, 2013, 04:27:13 PM
no it spawns, play with the code, if you give it a say command when it first starts up it will say it. and if you make a button that will return a say command at any time inside the process, it will say it.
Title: Re:Help with object spawning in the background
Post by: JaViS on May 30, 2013, 05:49:42 PM
ok, can you update your code and upload it again?


last time I revised it was working for me and not for u so I think it's important both of us to have the same version
Title: Re:Help with object spawning in the background
Post by: MisterN on May 30, 2013, 07:56:35 PM
just replace this part of enemy.prg
begin
z = -1;
ctype = c_scroll;
//upon startup it will either move left or right
dir = rand(0,1);
//load the sprites
enemy_r = load_png("enemy_r.png");
enemy_l = load_png("enemy_l.png");
get_id(procID);
say("i exist");
    loop
    if(key(_q))
        say("i still exist");
    end
    if (!out_region(id , 0))
Title: Re:Help with object spawning in the background
Post by: MisterN on May 31, 2013, 03:48:11 PM
put this into the main loop
if(key(_d))
            enemy(game_width,game_height);
            while(key(_d))frame;end
        end


I noticed that if theres more than 3 processes doing collision checks, the game slows down alot. if that is the case, then I cant really use this engine as is at the moment. i hope everything becomes spectacular soon one day.