Changing resources
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:
- 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.
- 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.
- 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.
- Resource manipulation can be slow. For example, changing
sprites or backgrounds is relatively slow. So don't use it during
the game play.
- 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 128x128
animated sprite and you decide to create 36 rotated copies of it
you will use up 36x32x128x128x4 = 72 MB of memory!
- 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