Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

help with boost code


Recommended Posts

I have almost everything i need for my rushing done but i need to know how to make him go faster.. Instead he dosnt move at all. When i removed the code he moves perfect. Heres the code im using,im also using sonic fgx engine, the full engine. and GM7.0 pro of course.

In step event i put


if Tension>1
{
Rush=true}
{
if Rush=true
{
hsp=50}
else
{
hsp=0}
[/CODE]

I tried all the horizontal speed variables already in Shadow but nothing worked..

am i doing something wrong?

Link to comment
Share on other sites

I'm assuming HSP is the speed variable? If so, that last bit about "else -> HSP=0" would mean if Sonic isn't in boost mode, he can't move (boolean's can only be true or not). That's why he can't move when you use your code.

Maybe switch "Rush" into an integer with three states (Boost mode, Boost off, and normal movement)?

Link to comment
Share on other sites

Never would of thought of that..[ I knew it made me stop i needed a fix for that]

Guess intergers would work if gm can support that. I might have to find a way

around some stuff but thanks.

Now i need more help heres my new code

i put it in step event,


if keyboard_check(vk_shift)
if Tension>0
{
Rush=true}
if Rush=true
{
hsp =15}
if Tension<2
{
Rush=false
}
[/CODE]

1.My problem is when shift is released he keeps Rushing.

2.He cant turn left he keeps going right.

Any help?

Link to comment
Share on other sites

You'd need to have in the left key event

if rushing = true

hsp *= -1 //this will reverse the hspeed because left speed is the same speed as right only negative.

I'm not sure about the shift thing but this code seems like of odd to me.

You realize that if keyboard_check(vk_shift) is only checking

if Tension>0 and if its false it skips to if Rush = true.

better code would probably be if(keyboard_check(vk_shift) && Tension > 0)

if that''s truely what you want it to do.

Seems to me you could also use

if(keyboard_key_release(vk_shift)) // I think that's right make sure it is its not something I use much

{rush = false}

that would set rush to false upon release.

Link to comment
Share on other sites

Thats about all of my problems for now... Thanx. :D

Edit..: here we go 2 more problems

heres my code this time theres more.

// Tension removal //
if keyboard_check(vk_shift) && x!=xprevious && Tension>0 {Tension=max(0,Tension-3)}
// Tension removal //

// This is my Right and Left rush variables //

if(keyboard_check_pressed(vk_left))
{
LLeft=true
}

if(keyboard_key_release(vk_left))
{
LLeft=false
}

if(keyboard_check_pressed(vk_right))
{
RRight=true
}

if(keyboard_key_release(vk_right))
{
RRight=false
}

// This is triggering the Rush

if(keyboard_check_pressed(vk_shift) && Tension>5)
{
Rush=true
}


// here i add speed //

if Rush=true && Tension>5 && RRight=true
{
hsp=10
}

// Left speed...//

if Rush=true && Tension>5 && LLeft=true
{
hsp=-10
}

// This should make it stop //
if (keyboard_key_release(vk_shift))
{
Rush=false
}[/CODE]

Problems =P..

1.He still cant stop,he only stops when he has 0 tension. (keyboard_key_release(vk_shift)) isnt helping AT ALL

2.when hes not Rushing,spindashing or jumping he cant move.

He CANT WALK.

3.never mind :D

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...