¿distancia de un objeto?

Started by MisterN, January 03, 2012, 02:18:40 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MisterN

¿Qué código puedo usar para obtener la distancia de un objeto? Solía usar "map_get_pixel" pero estoy tratando de buscar una mejor forma para la colisión. Para probar un poco cambie todo en mí código fall a:
// Implementation of fall.   
        ii = fall;   
        if(ii > 0)
            while(ii != 0)   
                if(collision(type level_mask))
                    ii = ii + 1;
                    falling=false;
                        if(!walking);
                            player_status=0;
                        else
                            player_status=1;
                        end
                break; 
            end   
            ii = ii - 1; 
            end   
        else   
            ii = 0; 
        end


Mas o menos funciona, pero no si hago que cada colisión funcione de esa forma. Estaría muy agradecido si alguien pudiera ayudarme.

SORRY FOR POOR TRANSLATION
werg

MisterN

changed

collide_level = collision(type level_mask);
        // Implementation of fall.     
        ii = fall;     
        if(ii > 0)
            while(ii != 0 and !collide_level)
                    //To illustrate simple behaviour implementation, I just check if there is an object somewhere on any x below this process:
                    if(collide_level.y > y - fall + ii)
                        ii = ii + 1;
                        //Some logic copied from your source which I think you'd want here
                        falling = false;
                            if(!walking);
                                player_status=0;
                            else
                                player_status=1;
                            end
                        break;
                    else if(collide_level.y < y - fall + ii)
                        //when hitting something above you:
                        //Some logic copied from your source which I think you'd want here
                        fall = 3;
                        break;
                    end
                    ii = ii - 1;   
            end     
        else     
            ii = 0;   
        end
     
        // Move the fall until we can.     
        y = y + (fall-ii);


error:
QuoteERROR: Runtime error in Player<65545> - process 0 not active
werg

MisterN

werg

SplinterGU

we need more code...

and you can execute the code with debug information... compile with -g and run with -d
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

MisterN

How can I do that with notepad++? I know I can run in debug mode.

i know for sure testing_jump has the original code (the map_get_pixel stuff), level_tree has levelmask.
werg

SplinterGU

Thanks, but I still need debug log...
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

MisterN

I don't know how to get that from notepad++ im sure it can be found though with the code I have supplied
werg

SplinterGU

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

MisterN

This is not linux, and I still have no idea. Can you or someone just try to help?
werg

SplinterGU

#9
is windows?

what is this?

edit: viendo tu primer post, creo que te convendria hablar en español, se te entiende mejor en español que en ingles.
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

MisterN

Estoy utilizando windows para esto, lo que sea con el bennupack.
werg

SplinterGU

#11
si desde el boton de inicio, Run o ejecutar, pones cmd.exe tienes la linea de comandos...

y haces igual que en linux...

cd directorio
bgdc -g programa.prg
bgdi -d programa
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

MisterN

How do I do directories in linux? Cause I get include errors.
werg

SplinterGU

you mean, how create new folders?

if you ask it, then you can use

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

MisterN

No, like
load_png("./folder/file.png");
load_song("./folder/song.ogg");
IMPORT "./file.prg";

in linux form, cause when I compile in linux, it doesn't work, and if I use the interpreter for the one I compiled on windows, it does not load songs or pngs. I remember josebita told me in an email something about he had to change the directories.
werg