FastFlash Posted February 4, 2014 Report Share Posted February 4, 2014 Ok, so i tried adding diagonal springs in the Sonic Dash+ engine in Game maker 8, but it works as a regular up spring, and I have no ideia why... Here's my diagonal spring code: case consSpringOrientationDiagonalLeft: if (scrPlayerCollisionRightObject(global.GravityAngle, 1, _ObjectHandle) && Gravity >= 0 && Speed >= 0) { Speed = -_ObjectHandle.SpringStrength; sound_stop(sndSpring); sound_play(sndSpring); } break; Any help would be apreciated! Link to comment Share on other sites More sharing options...
Light The Hedgehog Posted February 5, 2014 Report Share Posted February 5, 2014 Does it tell the player object to do horizontal movement? Link to comment Share on other sites More sharing options...
FastFlash Posted February 5, 2014 Author Report Share Posted February 5, 2014 (edited) Does it tell the player object to do horizontal movement? No, it didn't but i updated the code to tell the player to do horizontal movement and it still won't work: PS: the second line(the one with the scripts) is all in the same line case consSpringOrientationDiagonalLeft: if (scrPlayerCollisionRightObject(global.GravityAngle, 1, _ObjectHandle) && Speed >= 0) and (scrPlayerCollisionBottomObject(global.GravityAngle, 1, _ObjectHandle) && Gravity >= 0) { Speed = -_ObjectHandle.SpringStrength; Gravity = -_ObjectHandle.SpringStrength; Ground = false; Action = consActionSpring; sound_stop(sndSpring); sound_play(sndSpring); break; Edited February 5, 2014 by FastFlash Link to comment Share on other sites More sharing options...
Light The Hedgehog Posted February 5, 2014 Report Share Posted February 5, 2014 Try removing all of that and just adding hspeed += 10 vspeed -= 10 And tell me what happens. But put whatever the players object name (dot) hspeed and that good stuff. Please report back with your findings. Link to comment Share on other sites More sharing options...
FastFlash Posted February 5, 2014 Author Report Share Posted February 5, 2014 Try removing all of that and just adding hspeed += 10 vspeed -= 10 And tell me what happens. But put whatever the players object name (dot) hspeed and that good stuff. Please report back with your findings. It gives a weird affect. the player moves diagonally down slowly, like he was in the moon or something, but doesnt goes up Link to comment Share on other sites More sharing options...
Light The Hedgehog Posted February 5, 2014 Report Share Posted February 5, 2014 Hmmmm. I haven't touched the Sonic Dash+ engine so I can't exactly figure this out but is there a horizontal and a vertical spring code / script if so merge the two and see what results you get. Link to comment Share on other sites More sharing options...
FastFlash Posted February 6, 2014 Author Report Share Posted February 6, 2014 Hmmmm. I haven't touched the Sonic Dash+ engine so I can't exactly figure this out but is there a horizontal and a vertical spring code / script if so merge the two and see what results you get. I already did.The second code I posted was a "fusion" of the two codes, when I do that Sonic just acts as if it were a vertical up spring Link to comment Share on other sites More sharing options...
justin123 Posted February 6, 2014 Report Share Posted February 6, 2014 Try this: Speed = cos( degtorad(spring.direction))*_ObjectHandle.SpringStrength Gravity = sin( degtorad(spring.direction))*_ObjectHandle.SpringStrength You'll have to set the direction in each individual spring object depending on your implementation, but this code should move the player in the desired direction. This can be used for all springs, so I would recommend putting this into a script so your code look cleaner. Link to comment Share on other sites More sharing options...
FastFlash Posted February 7, 2014 Author Report Share Posted February 7, 2014 (edited) Gives me this error: ___________________________________________ ERROR in action number 6 of Step Event for object objPlayer: In script scrPlayerHandleObjectsSprings: Error in code at line 10: Speed = cos( degtorad(spring.direction))*_ObjectHandle.SpringStrength ^ at position 30: Unknown variable spring ______________________________________________________________________________ I tried changing spring.direction to objSpringParent.direction but it gives me this: ___________________________________________ ERROR in action number 6 of Step Event for object objPlayer: In script scrPlayerHandleObjectsSprings: Error in code at line 10: Speed = cos( degtorad(objSpringParent.direction))*_ObjectHandle.SpringStrength ^ at position 46: Unknown variable direction Edited February 7, 2014 by FastFlash Link to comment Share on other sites More sharing options...
Light The Hedgehog Posted February 10, 2014 Report Share Posted February 10, 2014 Try changing to Sonic.direction I think it's because you're assigning the Spring a direction? Which does. Again don't know much about Dash but I think thats why. Link to comment Share on other sites More sharing options...
FastFlash Posted February 10, 2014 Author Report Share Posted February 10, 2014 Try changing to Sonic.direction I think it's because you're assigning the Spring a direction? Which does. Again don't know much about Dash but I think thats why. Still doesn't work, maybe Sonic Dash uses a diferent direction system? I heard somewhere it uses a custom colision code, so maybe it uses a custom direction code too? Link to comment Share on other sites More sharing options...
Light The Hedgehog Posted February 10, 2014 Report Share Posted February 10, 2014 Most Game Maker things use custom movement variables and such, so if you can find Sonic movement variables then we could work with that. Most of the time it's Xsp or Vsp or vsp and such. Link to comment Share on other sites More sharing options...
FastFlash Posted February 11, 2014 Author Report Share Posted February 11, 2014 Most Game Maker things use custom movement variables and such, so if you can find Sonic movement variables then we could work with that. Most of the time it's Xsp or Vsp or vsp and such. You missunderstood, I meant the collision code is rewrited from scratch, it's totally diferent from Game maker's collision code Link to comment Share on other sites More sharing options...
justin123 Posted February 16, 2014 Report Share Posted February 16, 2014 Gives me this error: ___________________________________________ ERROR in action number 6 of Step Event for object objPlayer: In script scrPlayerHandleObjectsSprings: Error in code at line 10: Speed = cos( degtorad(spring.direction))*_ObjectHandle.SpringStrength ^ at position 30: Unknown variable spring ______________________________________________________________________________ I tried changing spring.direction to objSpringParent.direction but it gives me this: ___________________________________________ ERROR in action number 6 of Step Event for object objPlayer: In script scrPlayerHandleObjectsSprings: Error in code at line 10: Speed = cos( degtorad(objSpringParent.direction))*_ObjectHandle.SpringStrength ^ at position 46: Unknown variable direction Is direction no longer a default variable for objects (like x, y, etc.) in GML? I haven't programmed in it for a few years now. Anyways, the fix for this error is simply declaring the variable (its quite obvious btw). I really expected you to copy the idea, not the actual code lol. Link to comment Share on other sites More sharing options...
FastFlash Posted February 17, 2014 Author Report Share Posted February 17, 2014 Is direction no longer a default variable for objects (like x, y, etc.) in GML? I haven't programmed in it for a few years now. Anyways, the fix for this error is simply declaring the variable (its quite obvious btw). I really expected you to copy the idea, not the actual code lol. I've seted the direction in the spring's creation code, same error Link to comment Share on other sites More sharing options...
Recommended Posts