Using variables instead of constants?

Request patches for Keens 1-3.
Post Reply
Stealthy71088
Posts: 583
Joined: Thu Mar 17, 2005 11:54 pm
Location: NY

Using variables instead of constants?

Post by Stealthy71088 »

I'll be the first to admit that I don't understand much of how Keen is programmed, but I wish I understood a lot better.

From what I understand, many of our patches involve taking calls to memory and changing them so they use our constant values instead of the original ones. Is there a way we could have it call a multiple line method that returned a value instead? If we could create a patch that calculated a different value and returned that value each time the program ran it, we could create very different sprite behavior.

If we applied such a script to the firing height patch, we could have a sprite that fired at seemingly random heights within some interval, making our very own robo-red firing behavior.

If we applied it to an ice cube's speeds, we could make an ice cube arch, or maybe even move in a circle. I think there's a great deal of unexplored potential here.
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Post by levellass »

This is easy; that is after all what the random number table is for. (See the Keen wiki 'Probability and randomness' page)

The easiest thing to do is to have a variable change steadily for a random amount of time. Another strategy is to have a list of variables then randomly read one. (This is how the Vorticon's jump heights are handled.)



There's plenty of unexplored potential, and if you've played my most recent mod you'll know what happens when you tap that potential. People as far as I understand it are not too interested in it.
Post Reply