Zonar Games Posted July 6, 2006 Report Share Posted July 6, 2006 I'm trying to figure out how to implement a layering method for loops in my Sonic game using Damizean's 360 degree Sonic engine(new pack) in Gamemaker 6.1. Does anyone have a clue on how to do this? Link to comment Share on other sites More sharing options...
Kain Posted July 6, 2006 Report Share Posted July 6, 2006 It's a little complicated and I'm pretty sure he'll implement it himself in future versions (and I don't know how much he encourages use of current versions, but probably very little), but if you want to understand how it works: The way Damizean implemented 360 degree movement in his old engine was to have three types of blocks: solid blocks, high layer blocks, and low layer blocks. This was arranged by having three parent objects: "objSolid", "objHigh" and "objLow". Making a block have a parant of "objHigh" as oposed to "objSolid" means it's on the high layer and having it as "objLow" makes it on the low layer. If an object is objHigh, it's suposed to only test for collision if the layer = 1; if an object is objLow, it's suposed to only test for collision if the layer = 0; and if and object has objSolid as its parent, it's suposed to always test for collision. To implement, you go into each collision script and duplicate every collision test to test for each object depending on which layer you're on. (whether you hardcode or pass the layer is up to you). In the end, the collision parts will look something like this: collision_test = place_meeting(.......objSolid); if(layer==0) collision_test = collision_test && place_meeting(.......objLow); if(layer==1) collision_test = collision_test && place_meeting(.......objHigh); Dami actually uses a method where you can check any number of any of the layers at any time, but this is the simplified version. Also, slope checking might be a little complicated; try replacing the place_meeting calls with a simple script. Link to comment Share on other sites More sharing options...
Damizean Posted July 6, 2006 Report Share Posted July 6, 2006 Yes, the best way is to use how Kain said: I already implemented it on the Pack of Stuff, but I didn't release it. I, however, made a separated script called "place_meeting_layer" wich did those checks: var testResult; testResult = place_meeting(argument0, argument1, objSolid); if (!testResult) { if (layer==0) testResult = place_meeting(argument0, argument1, objLow); else testResult = place_meeting(argument0, argument1, objHigh); } return testResult; This way I only had to change slighty the function calls in the player_collision_xxxx scripts. As for layering itself, you only have to change the layer variable whenever you want to change Sonic's current depth. Also, for changing the current layer I usually use three objects for this: One object for switching layer to low Another for switching layer to high And another one for switching the layer, depending on the x_speed. This is the one I use for change layers in loops Good luck Side note: I encourage to use the new pack, because seems pretty much cleaner than the previous one, and it's fully commented Link to comment Share on other sites More sharing options...
rogueyoshi Posted July 6, 2006 Report Share Posted July 6, 2006 already done. the layering part was finished since march. this uses the new pack + lotsa extra crap. no need for credit, this project is open source, and i've yet to make a WIP page.btw dont steal any custom sprites, sounds, bgs. its an older version of the latest one which i have yet to upload. the latest one has genesis style paralax for the bgs, water, monitors, badniks, etc. only problem is, i cant do platforms with dami's engine yet. Link to comment Share on other sites More sharing options...
Damizean Posted July 6, 2006 Report Share Posted July 6, 2006 Hey hey, pretty good implementation you've got there rogueyoshi Though for what I've seen there are two major flaws: First one belongs to the objDebug objects: when deactivating the region, the arguments passed as width and height are wrong, since you're inputting the position of the player object as width, resulting in a probably large amount of objects reactivated, slowing down the room. The other one is that you're using way too many objects even as backgrounds: I suggest you don't do this, because if you put too many objects, the game will slow down as hell. Better use invisible objects for collision detection and background tiles for the visuals. Also, this would make even easier to design the levels Other than that, pretty good! Very good job! Edit: Ah, yeah, as for layering+platform example, I'll upload it in a sec: 1 Link to comment Share on other sites More sharing options...
rogueyoshi Posted July 6, 2006 Report Share Posted July 6, 2006 there is a reason that i put that activation code in for the player. i made it that if you go at a certain speed, you may out run the screen like in official sonic games. if that code wasnt implemented, no collision would occur if you go offscreen. i am going to use tiles w/ collision masks but that stage is just a test zone, and im way too lazy to do it for a zone that wont be in the final game. Link to comment Share on other sites More sharing options...
Damizean Posted July 6, 2006 Report Share Posted July 6, 2006 there is a reason that i put that activation code in for the player.i made it that if you go at a certain speed, you may out run the screen like in official sonic games. if that code wasnt implemented, no collision would occur if you go offscreen. Yeah, that's not what I meant. I meant that you would be activating far more objects as the player object x/y increased, since you we're passing the "width" and "height" arguments as the position, instead of the widht/height of the activation rectangle. Here's the correct one: instance_activate_region(global.P1.x-40,global.P1.y-40,80,80,1); instance_activate_region(view_xview[0]-80,view_yview[0]-56,view_wview[0]+160,view_hview[0]+112,1); Ok, here's the layering+static platform example. Moving platforms should be easy to implement off this: Download here Link to comment Share on other sites More sharing options...
Zonar Games Posted July 6, 2006 Author Report Share Posted July 6, 2006 Thanks alot guys! You guys are a major help!!! Link to comment Share on other sites More sharing options...
rogueyoshi Posted July 8, 2006 Report Share Posted July 8, 2006 thank you dami, you were a big help! Link to comment Share on other sites More sharing options...
Recommended Posts