Blue Emerald Posted June 16, 2009 Report Share Posted June 16, 2009 By now, you should all know from past threads that I'm still trying to get the hang of programming new physics into Worlds. This time, I'm determined to make my Badniks walk on the ground. I originally programmed them to walk back and forth in a straight line, but I'm no longer content with something that simple. I want to know how to make a Badnik crawl up and down slopes, and how it can sense when it's reached an area too steep to cross. Let's say I'm working with Crabmeat, a Badnik that's already been programmed into Sonic Worlds. What would I need to do to Crabmeat so that it could recognize a slope and it could crawl up or down any slope? What kind of events would I need so that Crabmeat, or any Badnik in particular could crawl up and down a slope? Much thanks to anyone who can solve my problem; this is a pretty important event to program into the game. Link to comment Share on other sites More sharing options...
luksamuk Posted June 16, 2009 Report Share Posted June 16, 2009 Actually, the first thing I think you should do is compare if the Crabmeat is inside the camera area. If you don't, the gravity would act on it making it fall (even if it is over a background). After it, use a simple slope finding code to do what you want. Crabmeat won't go up slopes like Sonic, what fits with what you want. I think. Link to comment Share on other sites More sharing options...
LarkSS Posted June 17, 2009 Report Share Posted June 17, 2009 Having the enemy actually know if a slope is too large to climb would either require additional sensors on the enemy that check for said slope, or the easier method of placing an invisible object that if touched, the enemy stops moving/goes in the opposite direction. As for progressing up and down slopes, you could try making it so if the enemy is overlapping the ground, position up a pixel and if it's not overlapping the ground, position down a pixel and mess around with that idea until you can get the enemy not to jitter up and down yet be able to handle the slopes. Using two ground sensors would help make this more stable in the same way Sonic handles things, but may require a fastloop check through all of the enemies just to isolate collisions and prevent mmf2 related problems with detecting which enemy is doing what. Link to comment Share on other sites More sharing options...
Blue Emerald Posted June 17, 2009 Author Report Share Posted June 17, 2009 I sort of see what you mean, Lark. So it's kind of the way I was doing things originally -- I had hidden collision sensors in the level that told the enemies when to change direction. That much I can do. As for a fastloop, I haven't done anything with those yet. In fact, I wouldn't exactly know how to begin, and it leaves me with a lot of questions. If I were to use sensors on the ground, could I make the fastloop recognize it? On top of that, how would this fastloop deal with bouncing Badniks? How many Alterable Values would need to be used in each Badnik in order for it to work, if any? As for embedding sensors into the enemy, I wouldn't know how to do that either, nor have I ever seen an example of this. It's something I have wanted to do, but I never knew how. Link to comment Share on other sites More sharing options...
LarkSS Posted June 17, 2009 Report Share Posted June 17, 2009 Check this out. It should help regarding the fastloop identifier and collisions among multiple objects using it. I think it uses repositioning along the ground too, so it may already work with slopes. Link to comment Share on other sites More sharing options...
Blue Emerald Posted June 17, 2009 Author Report Share Posted June 17, 2009 I already have the AI Example; in fact, I was using it as a guide to see how I could get Badnik gravity to work. Two issues came up: 1) when an enemy travels up a slope it gets stuck midway up the slope, and 2) the alterable values being used in this example contradict with the values being used on enemies in Sonic Worlds. Does it matter which alterable value letters are used? [EDIT] Okay, I just found out that the alterable value letters do matter. Also, the enemies in the example know how to go up a slope, but they don't know how to go down a slope. Link to comment Share on other sites More sharing options...
LarkSS Posted June 17, 2009 Report Share Posted June 17, 2009 It doesn't matter which values are used. Also, it wasn't meant to work with slopes, so if it gets stuck, then possibly raising the wall sensors up a bit would help. Link to comment Share on other sites More sharing options...
Blue Emerald Posted June 17, 2009 Author Report Share Posted June 17, 2009 Really? Because when I converted Values A through L to Values M through X respectively, the enemies all fell through the floor. I'll try it again; I could have possibly missed something. On the plus side, when checking bottom-left and bottom-right collisions, I extended the X Left and X Right sensors to +16 and -16 respectively, and now the enemies can move down slopes. I created invisible collision boxes in the frame to make sure the enemies didn't fall off ledges. Link to comment Share on other sites More sharing options...
LarkSS Posted June 17, 2009 Report Share Posted June 17, 2009 Usually when I get a problem after moving values around, it tends to be one thing or two things that I forgot to change which breaks everything. You should always double check values if you decide to move them and take your time so you don't mess up and have a fun time fixing it later. Also, if you're still having trouble with this, you could probably get helped faster over AIM. 1 Link to comment Share on other sites More sharing options...
Blue Emerald Posted June 18, 2009 Author Report Share Posted June 18, 2009 Yep, that's what happened. I missed a few events when I was changing the values around. By the way, are the alterable values in the enemies directly connected to the values in their qualifier, or are they separate values? Also, I'll be sure to add you on AIM. I may need further help with this sometime. In the meantime, I'll rep you for getting me this far. Thank you. Link to comment Share on other sites More sharing options...
LarkSS Posted June 18, 2009 Report Share Posted June 18, 2009 They're connected; the qualifier just makes it possible to do an action or condition across multiple objects, so if you do something to the value of a qualifier, the same thing happens to that same value in the object regardless of the name of its value. ( Naming stuff is just for simplicity. ) 1 Link to comment Share on other sites More sharing options...
Recommended Posts