UltimateSonic Posted November 20, 2006 Report Share Posted November 20, 2006 I have another thread going on but its about a totally different problem. If the Mods have a problem with me making a new one, please merge this with my other thread. Well, I know how to do checkpoints. Each time Sonic hits one, it stores his x and y position in global variables. Now, Suppose the level is like this: ..*.......|.................|.............. .......................................................|................................[/CODE]The |'s are Checkpoints. The ...'s make up the ground. Sonic is the *.Going from Left to right on the first row are Checkpoints 1 and 2. On the second row is Checkpoint 3.[u]Scenario #1[/u]Suppose Sonic jumps over Checkpoint 1 and gets checkpoint 2. Then he dies. Starting at 2, Sonic goes backwards to Checkpoint 1. [b] How do I make sure that this checkpoint is already "on" and he cannot get it because he has "passed" it?[/b][u]Scenario #2[/u]Sonic Starts and goes to the left to fall to the second row. Sonic goes right and gets Checkpoint 3. Sonic somehow dies. [b] How do I make sure that Checkpoint 1 and 2 are already "on" and he cannot be gotten because he has "passed" them?[/b]If I solved Scenario #1 by making a statement such as, "If Sonic's X value is greater than the X value of a Checkpoint, turn the checkpoint on", it wouldn't work for Scenario #2, as Checkpoint 2's X value is greater than Checkpoint 3's.Thanks! I'd appreciate help! Link to comment Share on other sites More sharing options...
Damizean Posted November 20, 2006 Report Share Posted November 20, 2006 As in, you only have to record starting position of Sonic since each time he passes a check point X position, they're activated, even if you don't touch them. If you got up to Checkpoint 2, and the level restarts and Sonic is repositioned in Checkpoint 2, Checkpoint 1 should automatically be activated, since position X is greater than checkpoint's. You'll have to use max(Recorded X, Checkpoint X) if you want to make sure the position isn't swapped back, though. Link to comment Share on other sites More sharing options...
UltimateSonic Posted November 20, 2006 Author Report Share Posted November 20, 2006 Can you please describe what that function does? (Max) Otherwise, you understand my problem perfectly. Also, what if I'm at a position between Checkpoints 1 and 2 but at a different Y coordinate? (I'm underneath the two checkpoints) I want to make sure 1 and 2 are lit even if I get 3, which is at a less X value than 2, but at a different Y. (Like the picture on my first post) Link to comment Share on other sites More sharing options...
USC Posted November 21, 2006 Report Share Posted November 21, 2006 Couldn't you just use another Global value, that adds up every time you hit a check point? Then, everytime the level restarts, you do something like this... 1. If VariableA > 0 then *Checkpoint 1 is activated 2. If VariableA > 1 then *Checkpoint 2 is activated. ...etc,etc. Link to comment Share on other sites More sharing options...
UltimateSonic Posted November 21, 2006 Author Report Share Posted November 21, 2006 Wouldn't I have to assign a number to every checkpoint then? Link to comment Share on other sites More sharing options...
USC Posted November 21, 2006 Report Share Posted November 21, 2006 I suppose so. Wouldn't be that hard... 1. If Sonic collides with Checkpoint 1 AND VariableA < 1 then *VariableA = 1 2. If Sonic collides with Checkpoint 2 AND VariableA < 2 then *VariableA = 2 That prevents you from going back to an earlier checkpoint and screwing up the chain of events. Link to comment Share on other sites More sharing options...
TRD Posted November 21, 2006 Report Share Posted November 21, 2006 Actually, I would put seperate checkpoints for the level if there is multiple ones. I know what you're talking, about because I tried putting more than one checkpoint in a level but it was the same object. Didn't work. Yeah just make multiple checkpoints of different objects and a counter for it. If you don't understand, let me make a tutorial for you. Link to comment Share on other sites More sharing options...
UltimateSonic Posted November 21, 2006 Author Report Share Posted November 21, 2006 Actually, I would put seperate checkpoints for the level if there is multiple ones. I know what you're talking, about because I tried putting more than one checkpoint in a level but it was the same object. Didn't work. Yeah just make multiple checkpoints of different objects and a counter for it.If you don't understand, let me make a tutorial for you. Actually, I'd prefer not to create different objects. However, USC's idea has gotten me thinking... would it be more efficient to add one to a value each time you get a different checkpoint and start Sonic from there? Link to comment Share on other sites More sharing options...
TRD Posted November 21, 2006 Report Share Posted November 21, 2006 USC's idea has gotten me thinking... would it be more efficient to add one to a value each time you get a different checkpoint and start Sonic from there? Try it out and see. Link to comment Share on other sites More sharing options...
USC Posted November 21, 2006 Report Share Posted November 21, 2006 The only problem with that is, what if you skip the first checkpoint and go straight to the second one? Then your value will be 1, which the game will read as going to the first checkpoint. Link to comment Share on other sites More sharing options...
UltimateSonic Posted November 21, 2006 Author Report Share Posted November 21, 2006 Edit: Ah, wait what I was thinking of would require many different checkpoint objects T_T Is there another way to do this? Or... maybe is there some distance formula I can use? Link to comment Share on other sites More sharing options...
USC Posted November 21, 2006 Report Share Posted November 21, 2006 Huh. Well, you could make this a level specific thing (meaning you'd have to redo this everything level), and just determine which ones should be on by Sonic's starting position. For instance... 1. If Sonic X position = 20 AND Sonic Y position = 100 THEN *Activate Checkpoint 1 *Activate Checkpoint 2 1. If Sonic X position = 34 AND Sonic Y position = 50 THEN *Activate Checkpoint 1 Is that of any help, or have you already rejected that as an option? Link to comment Share on other sites More sharing options...
UltimateSonic Posted November 21, 2006 Author Report Share Posted November 21, 2006 Yeah I really don't want to do anything level specific in the engine. Link to comment Share on other sites More sharing options...
TRD Posted November 21, 2006 Report Share Posted November 21, 2006 Ultimate Sonic, I know you didn't want to work with seperate checkpoints, but try this and see if it helps: [ATTACH]108[/ATTACH] If you decide to use it, just give Dark Sonic credit, because he made a tutorial on this and I just modified it to make multiple checkpoints. No credit for me. Btw,I know what you were talking about, you want the checkpoints to be activated when say, you activate checkpoint 2, the first checkpoint will be activated too, but you don't want to return to the first one when you die, well I made this tutorial specificly like that. Try dieing on purpose to see also skip one or two checkpoints (There are 4 in this tutorial) activate the one ahead, then go back and check out the other ones. They should be activated too, but you will not return to it when you die. Link to comment Share on other sites More sharing options...
UltimateSonic Posted November 21, 2006 Author Report Share Posted November 21, 2006 Ah. I figured a way to do it for levels that go from top to bottom. However, it keeps checking as long as there is a checkpoint active. I there a way to check each time you get a checkpoint? It doesn't work if you tell it to do it on collision with Sonic because then it checks for only that specific checkpoint. Link to comment Share on other sites More sharing options...
LarkSS Posted November 21, 2006 Report Share Posted November 21, 2006 Just spread 1 in Alterable Value A of all the checkpoints. That'll make the order of the checkpoints based on the order you placed them in the level editor. Now whenever you touch a checkpoint and its Value A is bigger than 1, run a loop to the number of the checkpoint you hit. As the loop is active and its index value matches the Value A of a checkpoint, activate that checkpoint. This will make it so if you skip a checkpoint, the ones before it are activated along with the one you just touched. Also, the loop shouldn't slow the game down at all as it's done once per checkpoint and you probably won't have more than 50 in a level at once. =P Link to comment Share on other sites More sharing options...
DimensionWarped Posted November 21, 2006 Report Share Posted November 21, 2006 Can you set the alterable value for individual instances of an object to have a different initial value for each instance? If so, then you could just number all of your checkpoints that way and do the comparison operation mentioned above to determine which checkpoints can still be activated and the current respawn position. Link to comment Share on other sites More sharing options...
UltimateSonic Posted November 21, 2006 Author Report Share Posted November 21, 2006 Just spread 1 in Alterable Value A of all the checkpoints. That'll make the order of the checkpoints based on the order you placed them in the level editor. Now whenever you touch a checkpoint and its Value A is bigger than 1, run a loop to the number of the checkpoint you hit. As the loop is active and its index value matches the Value A of a checkpoint, activate that checkpoint. This will make it so if you skip a checkpoint, the ones before it are activated along with the one you just touched. Also, the loop shouldn't slow the game down at all as it's done once per checkpoint and you probably won't have more than 50 in a level at once. =P Can you please elaborate? Also, how can I make it check only when Sonic gets a new checkpoint, not constantly check? Thanks! Link to comment Share on other sites More sharing options...
LarkSS Posted November 21, 2006 Report Share Posted November 21, 2006 I'm working on a tutorial for you that's taking longer than expected, so I'm just letting you know what I'm up to ahead of time. Also, it does only check when you hit a new checkpoint. It would be silly to have it constantly check. =P Edit: I'm having problems with the tutorial. I know the loop to check for deactivated checkpoints prior to what you've touched is correct, but it refuses to work. I checked the Alterable Values of the checkpoints and they're correct. When I try to change a part in the loop like adding 1 to the index value, it activates all the checkpoints at once, but if I keep it normal, none of them activate. I'd appreciate it if someone could fix the problem. Download Checkpoint Tutorial Link to comment Share on other sites More sharing options...
UltimateSonic Posted November 21, 2006 Author Report Share Posted November 21, 2006 Ah, I look forward to it =) Just curious, and not to rush you, how long will it take? Please tell me when it is finished! Link to comment Share on other sites More sharing options...
LarkSS Posted November 21, 2006 Report Share Posted November 21, 2006 *points to my post before yours* =D Link to comment Share on other sites More sharing options...
UltimateSonic Posted November 22, 2006 Author Report Share Posted November 22, 2006 Now we're getting somewhere =) In your tutorial, I placed three checkpoints in a row. I got the third one but I was still able to get the two before it. Could you look into that? Thanks ^^ Link to comment Share on other sites More sharing options...
LarkSS Posted November 22, 2006 Report Share Posted November 22, 2006 Wait, were you able to fix the problem I mentioned? I can't even get the checkpoint to activate without activating all the others too or none at all. Also, I forgot to mention that you need to place the checkpoints from last to first for it to work. Btw, if that problem can't be fixed, I may just ignore the loop system and use the checkpoint's position instead. It may not be the best method for levels that go to the right, then left in other parts, but it'll at least get you passed the problem you originally had. Link to comment Share on other sites More sharing options...
UltimateSonic Posted November 22, 2006 Author Report Share Posted November 22, 2006 Also, I forgot to mention that you need to place the checkpoints from last to first for it to work. I figured that out ^_~ Wait, were you able to fix the problem I mentioned? I can't even get the checkpoint to activate without activating all the others too or none at all. Well ... not really ; Btw, if that problem can't be fixed, I may just ignore the loop system and use the checkpoint's position instead. It may not be the best method for levels that go to the right, then left in other parts, but it'll at least get you passed the problem you originally had. Hmm... I have a problem kinda like this now: + On loop "CheckpointLoop"+ LoopIndex( "CheckpointLoop" )<= Alterable Value A( "Checkpoint" )+ Animation Stopped is Playing (Checkpoint) -Change Animation Sequence to On (Checkpoint)[/CODE]Apparently, its turning on every single checkpoint... Link to comment Share on other sites More sharing options...
Damizean Posted November 22, 2006 Report Share Posted November 22, 2006 Here you go Edit: Fixed & crap. Link to comment Share on other sites More sharing options...
Recommended Posts