Bilder und Musik Extern Laden

  • GM 6

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • Bilder und Musik Extern Laden

    Hallo leute ich weiß das man Sprites extern laden kann um das Spiel schneller laden zu lassen nur wie sieht der Code aus und wie benuzt man den ?
    Habe mir den schonmal angeguckt ur da war der für mich zu kompliziert und das ist er glaube ich immer noch :rolleyes:
  • Hier mal ein Auszug aus der Hilfe, betrifft aber nur Sprites. Für Backgrounds müsstest du dann selber mal nachschlagen. Es gibt verschiedene Möglichkeiten, kompliziert ist das aber nicht:
    sprite_add(fname,imgnumb,precise,transparent,smooth,preload,xorig,yorig) Adds the image stored in the file fname to the set of sprite resources. Many different image file types can be dealt with. When the image is not a gif image it can be a strip containing a number of subimages for the sprite next to each other. Use imgnumb to indicate their number (1 for a single image). For (animated) gif images, this argument is not used; the number of images in the gif file is used. precise indicates whether precise collision checking should be used. transparent indicates whether the image is partially transparent. smooth indicates whether to smooth the edges. preload indicates whether to preload the image into texture memory. xorig and yorig indicate the position of the origin in the sprite. The function returns the index of the new sprite that you can then use to draw it or to assign it to the variable sprite_index of an instance. When an error occurs -1 is returned.
    sprite_add_alpha(fname,imgnumb,precise,preload,xorig,yorig) Adds the image stored in the file fname to the set of sprite resources, but this time the file has an alpha channel to indicate transparency (as for example in .png files). The arguments are the same as above (but two are missing as they are not relevant in this case). When an error occurs -1 is returned.
    sprite_replace(ind,fname,imgnumb,precise,transparent,smooth,preload,xorig,yorig) Same as above but in this case the sprite with index ind is replaced. The function returns whether it is successful.
    sprite_replace_alpha(ind,fname,imgnumb,precise,preload,xorig,yorig) Same as above but in this case the file has an alpha channel. The function returns whether it is successful.
    █████ ██ █ ████ everything ███ █████ is █████ ████ ████ fine ████ ███ █ ██████ love.
    █████ ███████ ███ your █████ ████ government.
  • Die deutsche Game Maker 6 Hilfe gibts hier: gm-d.de/help
    Und die deutsche ( nicht fertig übersetzte ) Game Maker 7 Hilfe gibts hier: gm-d.de/helpdev

    Hier mal ein Beispiel, wie du einen Sprite Extern Laden kannst.

    GML-Quellcode

    1. spr_player = sprite_add("spr\player.gif",3,false,true,false,true,0,0);
    2. sprite_index = spr_player;


    Du musst das 'sprite_add' nicht immer im Create Event ausführen, wenn du globale Variablen verwendest... Also:

    GML-Quellcode

    1. global.spr_player = sprite_add("spr\player.gif",3,false,true,false,true,0,0);
    2. sprite_index = global.spr_player;
  • Benutzer online 1

    1 Besucher