qrleon's picture
Game File: 

He knew he was out of his league. He hadn't practiced for the event. He was out of breath. Gasping for air. Yet he was on the track, competing, trying not to trip or be trampled by the other runners. It could only end in shame.


Made For: 
Pirate Kart 2


Danni's picture

Your use of the "spread

Your use of the "spread number in alterable value" action never ceases to amaze me.

snapman's picture

Spread a number

I've never experimented with that, mostly out of not having a reason to do so. Can somebody tell me what that does?

Noyb's picture

It basically gives a unique

It basically gives a unique ID number to each copy of an active object of the same type. So spreading the value 1 in alterable value A in the active object "Runner" would uniquely identify each instance of "Runner" with the values 1 to the number of total Runner objects. The object with value 1 would be the first created instance (first one you placed in the level editor, or first created by a create action if none are in the level editor) and the instance with the highest value would be the last created instance.

In this game, qrleon uses the spread value function to give each runner a different horizontal speed (Always: x("Runner") = x("Runner") + Alterable Value A("Runner")) without requiring a lot of separate active object types or code.

It's also occasionally useful to positively identify specific instances by an ID number (using the alterable value A of Runer == XX condition).

Danni's picture

It takes all the instances

It takes all the instances of an object and gives each a unique number x through n + x - 1, where x is the number you tell it to spread (usually 0 or 1), and n is the number of instances. qrleon uses it a ton (setting velocities), which makes for some interesting effects.

Edit: Oops, ninja'd.

Spreading a number over an

Spreading a number over an alterable value of an active object assigns a different value to each instance of that object. (0,1,2,3,4,5, etc)

This can be used to identify individuals and allows the programmer more control over each object. That is, the programmer can create different events to effect multiple instances of an object differently based on it's unique ID variable.

alterable value A of ("Invader")= 1
("Invader") overlaps ("Bullet")
--> Destroy ("Invader")

alterable value A of ("Invader")= 2
("Invader") overlaps ("Bullet")
--> Destroy ("Bullet")

I'm not sure if that makes sense? It was kind of a horrible example, but I couldn't think of anything better on the spot. :P


I think I must type slow or something... geez, everyone answered before me! :D

qrleon's picture

I think it was mainly

I think it was mainly implemented in KNP to facilitate the creation of card games and the like. You can use it with a counter to iterate through instances, if you don't mind that it only works on one instance per frame.

I pretty much only use it for off-by-one joke effects. It's one of the easiest and fastest KNP crutches to set up!

snapman's picture

Well that will save some time

Haha all this time I've been writing "repeat # of objects times" and incrementing a counter to do that. It doesn't really save me that much time, other than moving that in to my level start event, and happening in one frame. How about those internal flags? Anybody use them much?

And in return for answering my question, I'll mention that you can set preferences for the event editor, such as shrinking the size of the event grid icons, switching to all text, or even turning off automatic event generation for the default movements (handy if you don't want to keep deleting default actions every time you want to do something custom). You can even set KnP up to load directly to making a new game.

Danni's picture

I still wish Klik & Play

I still wish Klik & Play would let me display the checkmarks while scrolling. Or allow me to copy and paste events (The Games Factory has both of these things).

snapman's picture

I wonder if they will ever

I wonder if they will ever release "The Games Factory for Schools"?

Danni's picture

I'm thankful that I still

I'm thankful that I still have The Games Factory, legit and working. Is the Home Version, but oh well. I do wish that others could have the opportunity to use it for free.

While TGF has a 32-bit runtime (along with 16-bit), there's another issue it has with high-end machines that Klik & Play didn't have. It basically originates from the sound code, which for some reason was used to control the game timing. If too many sounds play at once for too long, sometimes the game becomes unresponsive (until it receives input events - in which case it steps single frames) and the sound buffer gets stuck in a loop. On a single core, it can take a while to happen. On multi-core, however, it can happen very quickly, due to the nature of timing on those systems. Thankfully, there's a fix for that - you set the processor affinity to use just CPU 0 (and this can be done in a .bat file, so that it is applied every time you want to run the game).

qrleon's picture

wait, KNP has active object flags?

Any way to toggle them?

Danni's picture

TGF does. KNP doesn't, as

TGF does. KNP doesn't, as far as I can tell. I have no idea what the internal flags thing is for (possibly meant for debug?). But KNP does have fixed object values.

qrleon's picture

They're in there!

Under "retrieve data from object".

An unfinished feature, maybe?

Danni's picture

Probably. You can retrieve

Probably. You can retrieve the data from an internal flag in Klik & Play, but there is no facility to set one. TGF does, and retrieving the internal flag returns a 1 if it's set to on, 0 if it's off.

qrleon's picture

Huh. Thanks for clearing

Huh. Thanks for clearing that up.