Risorse

In GameMaker si possono definire diversi tipi di risorse, come spritesuonifontoggetti, ecc.
In questa sezione trovi un certo numero di funzioni che danno informazioni sulle risorse.

Information on resources can be found in the following pages: Sprites, Sounds, Backgrounds, Fonts, Paths, Scripts, Time lines, Objects, Rooms.

 

Modificare le risorse

This functionality is only available in the Standard Edition of GameMaker.

It is possible to create new resources during the game.
Also you can change existing resources.
This chapter describes the possibilities.

Be warned though.
Changing resources easily leads to serious errors in your games!!!
You must follow the following rules when changing resources:

  1. Don’t change resources that are being used.
    This will lead to errors!
    For example, don’t change a sprite that is being used by an instance.
  2. When you save the game during playing, added and changed resources are NOT stored with the save game.
    So if you load the saved game later, these might not be there anymore.
    In general, when you manipulate resources you can no longer use the built-in system for loading and saving games.
  3. When you restart the game during playing, the changed resources are NOT restored to their original shape.
    In general, when you manipulate resources you can no longer use the action or function to restart the game.
  4. Resource manipulation can be slow.
    For example, changing sprites or backgrounds is relatively slow.
    So don’t use it during the game play.
  5. Creating resources during game play (in particular sprites and background) easily uses huge amount of memory.
    So be extremely careful with this.
    For example, if you have a 32 frame 128×128 animated sprite and you decide to create 36 rotated copies of it you will use up 36x32x128x128x4 = 72 MB of memory!
  6. Make sure you delete resources you no longer need.
    Otherwise the system soon runs out of memory.

In general, you should not change any resources during game play.
Better create and change the resources at the beginning of the game or maybe at the beginning of a room.

Information on changing resources can be found in the following pages: Sprites, Sounds, Backgrounds, Fonts, Paths, Scripts, Time lines, Objects, Rooms.

Lascia un commento