Scoping
Programming
The scripting language I use is specifically designed for powering this style of game, which means it has some idiosyncracies that may seem odd and unique.
One of these is the method I use for scoping.
If you define "IMAGE flyingpig", you end up with an image which can be referred to as "flyingpig", no matter which file you use. If you run the same file again, you won't get another image: you'll just modify the existing image.
This is great for cut scenes, not so good for creating swarms of enemies. Thus I have the "bang name". That's when you preface a name with an exclamation point.
A bang is converted over into a number. Every time you run a file which creates a bang, the number of the next bang is increased by one.
So, "IMAGE !flyingpig" will create a new image every time you call it. The images will have the names 0flyingpig, 1flyingpig, 2flyingpig, etc. However, you'll probably never explicitly state the number-translated name:
Instead, you can pass around your bang, and set your bang equal to variables.
For example, "RETURN !" returns the number of the bang. So, the first time it gets run, it returns "0", then "1", etc.
If you call that file like so: "var ! = pack MakeFlyingPig" then you'll set your local bang equal to the bang of the flying pig, even though this bears an irritating resemblence to a "not equal to". Then you can reference it. So you can do something like:
This ends up creating the images 0pigwing and 1flyingpig.
I have limited it: "!" is the only variable which can be used in this manner. But it is as much as this kind of system needs.
The scripting language I use is specifically designed for powering this style of game, which means it has some idiosyncracies that may seem odd and unique.
One of these is the method I use for scoping.
If you define "IMAGE flyingpig", you end up with an image which can be referred to as "flyingpig", no matter which file you use. If you run the same file again, you won't get another image: you'll just modify the existing image.
This is great for cut scenes, not so good for creating swarms of enemies. Thus I have the "bang name". That's when you preface a name with an exclamation point.
A bang is converted over into a number. Every time you run a file which creates a bang, the number of the next bang is increased by one.
So, "IMAGE !flyingpig" will create a new image every time you call it. The images will have the names 0flyingpig, 1flyingpig, 2flyingpig, etc. However, you'll probably never explicitly state the number-translated name:
Instead, you can pass around your bang, and set your bang equal to variables.
For example, "RETURN !" returns the number of the bang. So, the first time it gets run, it returns "0", then "1", etc.
If you call that file like so: "var ! = pack MakeFlyingPig" then you'll set your local bang equal to the bang of the flying pig, even though this bears an irritating resemblence to a "not equal to". Then you can reference it. So you can do something like:
IMAGE !pigwing
{
var oldbang = !
var ! = pack MakeFlyingPig
mount !flyingpig
set !flyingpig location 0 x -50
}
This ends up creating the images 0pigwing and 1flyingpig.
I have limited it: "!" is the only variable which can be used in this manner. But it is as much as this kind of system needs.
0 Comments:
Post a Comment
<< Home