Chaos Rush Posted January 3, 2009 Report Share Posted January 3, 2009 Okay, my main problem is: Notice how in the first pic, objSonic goes above the nut/screw thingy, and in the second pic objSonic overlaps the giant nut/screw/whatever. But if I have objPlayer do the same thing: It works perfectly fine, it doesn't overlap. Here's some information: 1. I'm using a simplified form of the X-mas engine (the one on the Firestorm Blog site) 2. objPlayer is a parent of objSonic Also I tried giving objPlayer the same animation system as Sonic, and it looks just fine. I think it has to do with the name of the object, but I've checked all collision scripts and none of them involve a specific, "objPlayer". So why does objSonic overlap the nut/screw thingy? Link to comment Share on other sites More sharing options...
AzureSonic Posted January 3, 2009 Report Share Posted January 3, 2009 Try moving Sonic up or down, or maybe its the way you interact with it. Check the coding also. The orgin of the sprites could be the problem also. Link to comment Share on other sites More sharing options...
VectorSatyr Posted January 3, 2009 Report Share Posted January 3, 2009 It's most likely that the x/y-origin of the sprite is slightly off. Try putting it dead center. Link to comment Share on other sites More sharing options...
Chaos Rush Posted January 3, 2009 Author Report Share Posted January 3, 2009 It's most likely that the x/y-origin of the sprite is slightly off. Try putting it dead center. If I do that it looks even more ugly. It's definitely not the sprite origin, since if I give the animation system to objPlayer, it works just fine. I know it has something to do with objPlayer/objSonic, but I've checked all collision scripts and "objPlayer" is found nowhere. Link to comment Share on other sites More sharing options...
AzureSonic Posted January 4, 2009 Report Share Posted January 4, 2009 *AzureSonic has entered the building* Maybe try messing around with the coding a bit will help. *AzureSonic has left the building* Link to comment Share on other sites More sharing options...
Chaos Rush Posted January 4, 2009 Author Report Share Posted January 4, 2009 *AzureSonic has entered the building*Maybe try messing around with the coding a bit will help. *AzureSonic has left the building* ...ARE YOU SERIOUS. THAT'S WHAT I'M TRYING TO FIGURE OUT. (stupid caps lock prevent...) Link to comment Share on other sites More sharing options...
Kain Posted January 4, 2009 Report Share Posted January 4, 2009 I could be wrong, but this looks much more like a timing problem than a collision problem (which means it should be pretty hard to fix), though I'm somewhat confused with why it works with objParent if it doesn't work with objSonic. Usually something like this happens whenever Sonic and the gimmick he's on preform their code at different times and thus the Draw Event happens in between the time the Gimmick moves and the time Sonic moves in response to the gimmick. What engine are you using? How do the parents work (i.e. does objSonic ever call "event_inherited()" or is the code just copy-pasted, with perhaps a bit of change)? Also, you can try drawing the objParent mask sprite with objSonic using just the simple draw_sprite command and seeing if the problem is, indeed, with position or it is with animation. Edit: whoops, I missed the part where you said you were using the X-Mas engine. I'll check it out and see if I come up with something. Edit2: OK, looking at the Sonic Dash engine at aerogp.ae.funpic.org, it only has the objPlayer object and does not have the Sonic object, thus I'm limited in what I can look at. However, I'm pretty sure it is a difference in timing between objPlayer and objSonic which is causing the problem. If you are not using event_inherited, but instead have copy-pasted the code from objPlayer into objSonic, then make sure you have copied it in the exact order it was from the objPlayer object. You might even consider using event_inherited unless you absolutely need to put code in the middle of the objPlayer code. If you are using event_inherited or do not have any code in the Step event for the objSonic object, then look in objSonic for code that is not in objPlayer which might change Sonic's position. Link to comment Share on other sites More sharing options...
Chaos Rush Posted January 4, 2009 Author Report Share Posted January 4, 2009 I could be wrong, but this looks much more like a timing problem than a collision problem (which means it should be pretty hard to fix), though I'm somewhat confused with why it works with objParent if it doesn't work with objSonic. Usually something like this happens whenever Sonic and the gimmick he's on preform their code at different times and thus the Draw Event happens in between the time the Gimmick moves and the time Sonic moves in response to the gimmick.What engine are you using? How do the parents work (i.e. does objSonic ever call "event_inherited()" or is the code just copy-pasted, with perhaps a bit of change)? Also, you can try drawing the objParent mask sprite with objSonic using just the simple draw_sprite command and seeing if the problem is, indeed, with position or it is with animation. Edit: whoops, I missed the part where you said you were using the X-Mas engine. I'll check it out and see if I come up with something. Edit2: OK, looking at the Sonic Dash engine at aerogp.ae.funpic.org, it only has the objPlayer object and does not have the Sonic object, thus I'm limited in what I can look at. However, I'm pretty sure it is a difference in timing between objPlayer and objSonic which is causing the problem. If you are not using event_inherited, but instead have copy-pasted the code from objPlayer into objSonic, then make sure you have copied it in the exact order it was from the objPlayer object. You might even consider using event_inherited unless you absolutely need to put code in the middle of the objPlayer code. If you are using event_inherited or do not have any code in the Step event for the objSonic object, then look in objSonic for code that is not in objPlayer which might change Sonic's position. To create objSonic, all I did was right-click objPlayer and selected, "duplicate object". Then I named the copy objSonic, and made it a child of objPlayer. Then I added the animation system from an older engine. Here, I'll PM you the source. Link to comment Share on other sites More sharing options...
Kain Posted January 4, 2009 Report Share Posted January 4, 2009 Sure enough, it's a timing issue, but it's a little more complicated than I thought. If you create a 100% duplicate object, objPlayer2, then you will see that the error occurs in this object as well. This happens because the Step events are performed in the order of their object ID (i.e. the first object ever created will perform all its step code first; note: I do mean object, not instance). Messed up, I know. You could quick-fix this by duplicating objScrewBolt, deleting the old one and using the new one, but that's not recommended since then you'd have to do that (including placing re-placing the objects on their respective maps) every time you added a new character. A more permanent solution eludes me. If I get rid of the code "scrPlayerHandleObjectsMovingPlatform();" from the Step Event and put it in the Begin Step Event, it works for objSonic (and all objects created after objScrewBolt), but doesn't work for objPlayer (and all objects created before). If I did this and then got rid of objPlayer, replacing it with a duplicate (which can have the same name after you get rid of the old one), it will permanently fix the problem objScrewBolt, but if you add any other moving platform objects, you will have to repeat the process of deleting all the old Player objects and replacing them with duplicates (not in that order, of course). Regrettably, that's the best solution I can come up with without intensely studying the specifics of this engine. Edit: Another thing that worries me is that I wonder if it only works because the object moves in a relatively fixed speed and direction. Come to think of it, I never got Pendulum-swinging platforms to work perfectly in my game for this very reason. Link to comment Share on other sites More sharing options...
Chaos Rush Posted January 4, 2009 Author Report Share Posted January 4, 2009 Insert Kain's post here. Well, I didn't know GM works that way. I'm only going to have 3 characters, so I'll just do your first "solution". EDIT: I'd like to give you a rep point, but it says that I need to spread more reputation. So....take an imaginary rep point! Link to comment Share on other sites More sharing options...
Recommended Posts