StealthyMC Posted August 12, 2011 Report Share Posted August 12, 2011 I thought it was simple, but it's not. I'm trying to make diaganol springs. But the problem is, when Sonic hits the spring, he only goes up, not diagonally. I put the new constants in and added it into the spring collision script. Any suggestions? Link to comment Share on other sites More sharing options...
MrChidna Posted August 12, 2011 Report Share Posted August 12, 2011 I thought it was simple, but it's not. I'm trying to make diaganol springs. But the problem is, when Sonic hits the spring, he only goes up, not diagonally. I put the new constants in and added it into the spring collision script. Any suggestions? I don't use Game Maker, but surely it'd be a case of telling it to change your XSpeed AND YSpeed at the same time? Link to comment Share on other sites More sharing options...
BlazefireLP Posted August 12, 2011 Report Share Posted August 12, 2011 Yep, it is a pretty simple process. Probably one of the bare basics actually. Don't use GM either though. Link to comment Share on other sites More sharing options...
VectorSatyr Posted August 12, 2011 Report Share Posted August 12, 2011 scrPlayerHandleObjectsSprings() _RelativeSpringOrientation = (_ObjectHandle.SpringOrientation-round(global.GravityAngle/90)) mod 4; An example: _ObjectHandle.SpringOrientation = 1; global.GravityAngle = 0; _RelativeSpringOrientation = (1-round(0/90)) mod 4; _RelativeSpringOrientation = (1-0) mod 4; _RelativeSpringOrientation = 1 mod 4; _RelativeSpringOrientation = 1; consSpringOrientationLeft = 1; _RelativeSpringOrientation = consSpringOrientationLeft; EDIT: Assuming you did what I think you did... _ObjectHandle.SpringOrientation = 4; global.GravityAngle = 0; _RelativeSpringOrientation = (4-round(0/90)) mod 4; _RelativeSpringOrientation = (4-0) mod 4; _RelativeSpringOrientation = 4 mod 4; _RelativeSpringOrientation = [b]0[/b]; consSpringOrientationUp = 0; [b]_RelativeSpringOrientation = consSpringOrientationUp;[/b] To add more axis, you need a larger sample: _RelativeSpringOrientation = (_ObjectHandle.SpringOrientation-round(global.GravityAngle/[b]45[/b])) mod [b]8[/b]; ... Understand? Link to comment Share on other sites More sharing options...
StealthyMC Posted August 12, 2011 Author Report Share Posted August 12, 2011 Yep, it is a pretty simple process. Probably one of the bare basics actually. Don't use GM either though. I know, it's pretty basic, and it's really easy to do in other engines. I put the code in for Sonic going up and going left. But he only goes up. Link to comment Share on other sites More sharing options...
StealthyMC Posted August 12, 2011 Author Report Share Posted August 12, 2011 scrPlayerHandleObjectsSprings() _RelativeSpringOrientation = (_ObjectHandle.SpringOrientation-round(global.GravityAngle/90)) mod 4; An example: _ObjectHandle.SpringOrientation = 1; global.GravityAngle = 0; _RelativeSpringOrientation = (1-round(0/90)) mod 4; _RelativeSpringOrientation = (1-0) mod 4; _RelativeSpringOrientation = 1 mod 4; _RelativeSpringOrientation = 1; consSpringOrientationLeft = 1; _RelativeSpringOrientation = consSpringOrientationLeft; EDIT: Assuming you did what I think you did... _ObjectHandle.SpringOrientation = 4; global.GravityAngle = 0; _RelativeSpringOrientation = (4-round(0/90)) mod 4; _RelativeSpringOrientation = (4-0) mod 4; _RelativeSpringOrientation = 4 mod 4; _RelativeSpringOrientation = [b]0[/b]; consSpringOrientationUp = 0; [b]_RelativeSpringOrientation = consSpringOrientationUp;[/b] To add more axis, you need a larger sample: _RelativeSpringOrientation = (_ObjectHandle.SpringOrientation-round(global.GravityAngle/[b]45[/b])) mod [b]8[/b]; ... Understand? I somewhat understood it, I'll try out your suggestion. Link to comment Share on other sites More sharing options...
OverbounD Posted August 13, 2011 Report Share Posted August 13, 2011 My spring code looks like this: // ==== FUNCTION ====================================================================// scrPlayerHandleObjectSpringDRight() // ================================================================================== // var _ObjectHandle; // ---- Spring -------------------------------------------------------------------- _ObjectHandle = instance_nearest(x, y, objSpringDRight); if(Action = consActionDead) exit; if( scrPlayerCollisionLeftObject(sprPlayerMask13, 1, _ObjectHandle) || scrPlayerCollisionBottomObject(sprPlayerMask15, 1, _ObjectHandle)) { Action = consActionNormal; FlagsAllowCommonInput = true; Ground = false; Gravity = _ObjectHandle.SpringPower*-1; Speed = _ObjectHandle.SpringPower; SpringVariable = true; sound_play(sndSpring); _ObjectHandle.image_speed = .2; } SpringPower is just a variable I'd set in the room editor instant creation code. So each spring could have its own speed. Its in the old STT gmk if you want to have a look http://dl.dropbox.com/u/5170721/Old_Gmk.rar Link to comment Share on other sites More sharing options...
StealthyMC Posted August 13, 2011 Author Report Share Posted August 13, 2011 My spring code looks like this: SpringPower is just a variable I'd set in the room editor instant creation code. So each spring could have its own speed. Its in the old STT gmk if you want to have a look http://dl.dropbox.com/u/5170721/Old_Gmk.rar Okay, thank you very much. This problem has been irratating me for the past couple of days. EDIT: I tried out your suggestion, but it gives me an error saying "unknown variable: SpringPower". Before you ask, I did right click on the spring and put in the room creation code: SpringPower. It still gave me an error. Link to comment Share on other sites More sharing options...
OverbounD Posted August 15, 2011 Report Share Posted August 15, 2011 When is this error occurring? At the moment of collision? Link to comment Share on other sites More sharing options...
Delta Hedgehog Posted August 16, 2011 Report Share Posted August 16, 2011 It's okay. The diagonal springs are now fully functional. Link to comment Share on other sites More sharing options...
Recommended Posts