JJames19119 Posted June 4, 2006 Report Share Posted June 4, 2006 This is a tutorial for teleporting like in Sonic 2, but with multiple people. I know there's probably a better way to do this but I figured, I was gonna take a quick shot at this anyway and there seemed to be no tutorials for it... Basically, there's a random value and a few counters. If your engine already keeps track of the X and Y positions of certain things, then this can be easily implemented into that. You can get it here: http://srpgp.supersanctuary.com/cloud9/teletut.zip Alternate Link if the one above doesn't work: http://www.supersanctuary.com/srpgp/cloud/teletut.zip And that's all. Link to comment Share on other sites More sharing options...
LarkSS Posted June 4, 2006 Report Share Posted June 4, 2006 Pretty nice. But I'd do it a little differently. Your method gets the job done faster, but takes more events. When the button is clicked, all counters randomize. Counter 1 gets to keep its value. If counter 2 is equal to counter 1, it'll randomize until it's different. When it's different and counter 3 is equal to counter 2, it'll randomize until it differs from counter 2. After that, if counter 4 is equal to counter 3 it'll randomize until it's different. After all counters are satisfied, the objects are positioned and play resumes. A fast loop may be best for this if you want to make it more quicker. Link to comment Share on other sites More sharing options...
JJames19119 Posted June 4, 2006 Author Report Share Posted June 4, 2006 Pretty nice. But I'd do it a little differently. Your method gets the job done faster, but takes more events.When the button is clicked, all counters randomize. Counter 1 gets to keep its value. If counter 2 is equal to counter 1, it'll randomize until it's different. When it's different and counter 3 is equal to counter 2, it'll randomize until it differs from counter 2. After that, if counter 4 is equal to counter 3 it'll randomize until it's different. After all counters are satisfied, the objects are positioned and play resumes. A fast loop may be best for this if you want to make it more quicker. Biggest problem with that is that you also have to make sure counter 3 doesn't equal counter 1 so that player 3 doesn't end up in the same place as player 1. And because of that, counter 4 is pointless; it'll always hit one exact number after each loop, trying to avoid counter 1, 2 and 3. Not only that, due to how MMF works you'd need a second party counter (In other words, a counter that's unrelated to the other counters) to tell if the counters are going in the right direction. As in, telling if the counter's number is valid or not, then moving onto the next counter if it is. Basically what I did was just reverse that; there's multiple counters used for telling which number is valid and one random number. The best part about it is that you can more or less use MMF's predictable random number generator less. I'll admit though, the way you thought of would be better if the user was, say using a really good random number generator. It would also use less events, something which is a godsend among people using hefty static engines or 360 engines. Link to comment Share on other sites More sharing options...
LarkSS Posted June 4, 2006 Report Share Posted June 4, 2006 Heh, I forgot about that. Basically, you just need to add more restrictions. For example, after counters 1 and 2 are satisfied, the program is checking counter 3. If counter 3 is equal to counter 1, it'll randomize. If it isn't, check if it is equal to counter 2. If not, continue to counter 4 which checks all three. Basically, counter 4 will end up taking on the last empty value. Eh, you way is much faster and cleaner though. I just thought I'd mention that. Link to comment Share on other sites More sharing options...
Recommended Posts