ZFGC

Resources => Coding => Topic started by: BlazeBigBang on October 07, 2012, 08:53:55 pm

Title: Collisions
Post by: BlazeBigBang on October 07, 2012, 08:53:55 pm
Okay, so, I'm having problems with this. I can't make Link collide against a wall, or in this case, a furnace. It's  kind of frustrating, as I don't know what should I do. Can someone help me at this?
Title: Re: Collisions
Post by: FrozenFire on October 08, 2012, 12:33:33 am
Are you using 4Sword and Niek's MC Engine, or something you made? Can you show your code for collisions?

If you're simply checking for solids, then be sure the furnace is solid. Otherwise you might specifically have to check for the furnace object. Or make a generic solid object and have it be a parent to the furnace (and any other objects you want to collide with) so you only have to check for the one solid object, which saves you a lot of coding in the long run.

Anyway, if you show me some code and/or explain a bit better what it's doing and what you want it to do, I should be able to help (if no one else does first).
Title: Re: Collisions
Post by: BlazeBigBang on October 08, 2012, 01:09:36 am
I'm using Niek and 4Sword's enginge, and I already made the objects solid, but Link still doesn't collide.
Title: Re: Collisions
Post by: Zhello on October 08, 2012, 01:12:55 am
So when objLink hits the solid object he passes through or you want him to stop completely? Or is objLink pushing when walking into the solid object?  :huh:
Title: Re: Collisions
Post by: BlazeBigBang on October 08, 2012, 01:16:34 am
I want him to completely stop. I also put the parent, but still isn't solid. I'm leaving attached a .rar with the .gmk file, so you can see it and tell me what's wrong.
Title: Re: Collisions
Post by: FrozenFire on October 08, 2012, 01:21:03 am
I want him to completely stop. I also put the parent, but still isn't solid. I'm leaving attached a .rar with the .gmk file, so you can see it and tell me what's wrong.

Not seeing the attachment? :huh:

EDIT: Nvm, I was too quick I guess.
Title: Re: Collisions
Post by: FrozenFire on October 08, 2012, 01:39:23 am
Ok, for one thing, practically nothing works correctly, like ledge jumping, any of the solids, etc. Only ice and falling in holes appears to work properly. I think Link's sprites for walking up and down need to have their origin fixed as well or they just need to be centered or something (left and right animations seem fine), but the sprites aren't what is causing the problem.

I think you just messed up some of the original engine somehow. I'm not sure if you did copy and paste and just missed some stuff or what, but it's clear that some key mechanics are screwed up. I'll check it out some more and see if I can figure it out. I'm gonna download the MC Engine again if I can find it, and I should be able to help then. That is, if no one else helps first.

EDIT:
Huh, the search finds nothing??? It didn't even find anything by searching for "engine"... What's up with that? So yeah, I can't find the MC Engine, but Diminish just posted below (as you can see) and he obviously knows more about it than I do, so no worries I guess.
Title: Re: Collisions
Post by: 4Sword on October 08, 2012, 01:39:35 am
Ha, some of the old code looks a little bit ridiculous and non-friendly. Anyway I think I figured out what the problems are in that no collisions are happening:
1) the sprite for mskShadow is empty, mskShadow is Link's collision mask. This is used in order to determine what Link is colliding with. Go into the sprite mskShadow and insert a blank, change its size to 14x7, and fill it with a non-transparent color.
2) for the furnace object, you need to change its parent object to parObstacle or parSolid, it shouldn't matter. parObstacle is the parent of all objects that can be run into though. Delete the collision event in the furnace object as well, it isn't needed.
3) change Link's properties so that he starts off as solid (check the solid box). If I remember right, I used Link not being solid to do ledge jumping, and the collision code is set up such that if Link is not solid, he can go through anything.
4) oh, and change the furnace's collision code to non-precise.
Title: Re: Collisions
Post by: BlazeBigBang on October 08, 2012, 01:48:12 am
There it goes! I downloaded again the engine, added the room and the object and worked. I'm gonna make a new copy, and then test to see if it's working. I'll tell you when I'm done.
Title: Re: Collisions
Post by: 4Sword on October 08, 2012, 03:12:53 pm
Another thing I failed to mention, while I can understand having the furnace as an object so that its sprite can be the animating flame - if the furnace is never going to move from its current position, it would be best to have the furnace represented with tiles, have an invisible wall placed where you would collide with that furnace, and then possibly have the flame animation be all that consists for the furnace object.

It doesn't matter much now, but if you add objects similarly to how you have, it'll bog down the game eventually. In other implementations of the engine, I used tile collisions for simple walls in order to reduce the number of wall objects (and because the tile-based method works in the free versions of Game Maker). I'll try to adapt that code more so that it works with the many features presented in the other engines.

Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved