Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1] 2   Go Down

Author Topic: [Request / Solved] [GML]Unwanted speed increase at room warp.  (Read 9405 times)

0 Members and 1 Guest are viewing this topic.

Gyrowolf

[Request / Solved] [GML]Unwanted speed increase ...
« on: April 04, 2006, 10:03:12 pm »
Problem: The player's speed increases everytime it warps to another room.

I checked all of my scripts and made sure nothing was adding or taking from the object's speed. But I can't figure out
whats going on.  :-\ It would be a major help if someone (with GML experience, of course) could take a look at the scripts, in case I'm missing something.

Thanks,
« Last Edit: February 24, 2012, 10:21:17 am by Niek »
Logged

Piers

Re: [GML]Unwanted speed increase at room warp.
« Reply #1 on: April 04, 2006, 10:59:07 pm »
Are you resetting the speed higher everytime the object is recreated?
Logged

some_damn_canadian

Re: [GML]Unwanted speed increase at room warp.
« Reply #2 on: April 05, 2006, 12:10:02 am »
I may not be REALLY good, but I know GML pretty well, can I look at them? n__n
Logged
Re: [GML]Unwanted speed increase at room warp.
« Reply #3 on: April 05, 2006, 10:18:22 am »
  • *
  • Reputation: +1/-0
  • Offline Offline
  • Gender: Male
  • Posts: 4588
Player's speed doubles? Use debug mode to watch what changes O_o.
Logged
the a o d c

Gyrowolf

Re: [GML]Unwanted speed increase at room warp.
« Reply #4 on: April 06, 2006, 05:39:51 am »
Sorry about the late reply. We were without internet for a while.

Are you resetting the speed higher everytime the object is recreated?

Not that I can see. I checked all of the scripts.
I may not be REALLY good, but I know GML pretty well, can I look at them? n__n

All right, I'll try to send it shortly.

Player's speed doubles? Use debug mode to watch what changes O_o.

I typed in the player's speed variable (I'm using a global variable) and nothing changes. I'm really confused now. :-\
Logged

mit

Re: [GML]Unwanted speed increase at room warp.
« Reply #5 on: April 06, 2006, 06:49:38 pm »
  • QBASIC programmer since age 4. Take that, world.
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 1079
Quote
I typed in the player's speed variable (I'm using a global variable) and nothing changes. I'm really confused now.

Perhaps it isn't the speed variable changing, but the room speed, so that everything would speed up. Is this what you're getting? Is anything else speeding up with the player? Might not be this, but worth a look.
Logged
Programmer / Spriter / Level designer / Game Director / Web Designer / Music Sequencer for
Random Highscore table:

Play the Kousou Arcade today!
  • Kousou Games

Gyrowolf

Re: [GML]Unwanted speed increase at room warp.
« Reply #6 on: April 06, 2006, 07:51:01 pm »
Perhaps it isn't the speed variable changing, but the room speed, so that everything would speed up. Is this what you're getting? Is anything else speeding up with the player? Might not be this, but worth a look.

This is what I thought at first too, but after some testing, I found that nothing else speeds up but the player.
Logged
Re: [GML]Unwanted speed increase at room warp.
« Reply #7 on: April 07, 2006, 03:39:21 am »
  • The hero of Link
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 112
go to the properties of the characeter you conrtrol
insert 'step'
inser a 'Execute a piece of code'
put this code into that box
Code: [Select]
if keyboard_check(vk_left) && place_free(x-3,y){x-=3;image_speed=2.0;global.facing="left";}
if keyboard_check(vk_right) && place_free(x+3,y){x+=3;image_speed=2.0;global.facing="right";}
if keyboard_check(vk_up) && place_free(x,y-3){y-=3;image_speed=2.0;global.facing="up";}
if keyboard_check(vk_down) && place_free(x,y+3){y+=3;image_speed=2.0;global.facing="down";}

and that works for me.
Logged
  • A.D. Zelda

Gyrowolf

Re: [GML]Unwanted speed increase at room warp.
« Reply #8 on: April 07, 2006, 03:58:50 am »
I have:
Code: [Select]
//Left Key
lKeyEv =
"{
if (global.pause = false){
sprite_replace(spr_cm,global.cmL_spr,2,0,1,0,0,0,0);
x-= global.cmSpeed
global.curDir = 2;
}
}"

//Right Key
rKeyEv =
"{
if (global.pause = false){
sprite_replace(spr_cm,global.cmR_spr,2,0,1,0,0,0,0);
x+=global.cmSpeed
global.curDir = 0;
}
}"

//Up Key
uKeyEv =
"{
if (global.pause = false){
sprite_replace(spr_cm,global.cmU_spr,2,0,1,0,0,0,0);
y-=global.cmSpeed
global.curDir = 1;
}
}"

//Down Key
dKeyEv =
"{
if (global.pause = false){
sprite_replace(spr_cm,global.cmD_spr,2,0,1,0,0,0,0);
y+=global.cmSpeed
global.curDir = 3
}
}"
and it works fine. The problem is that the speed increases every time he enters a different room.

I'm using external scripts, btw, in case that helps some.
Logged

Ben

Re: [GML]Unwanted speed increase at room warp.
« Reply #9 on: April 07, 2006, 09:50:27 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 437
There are two reasons why I can think it would happen.
1) You're changing the speed, but you said you haven't or
2) You're executing the code twice, before it's drawn.

Check for that.
Logged
Want a place to upload your sprites and games for FREE? Look no further than GameDevotion

Gyrowolf

Re: [GML]Unwanted speed increase at room warp.
« Reply #10 on: April 07, 2006, 10:10:40 pm »
There are two reasons why I can think it would happen.
1) You're changing the speed, but you said you haven't or
2) You're executing the code twice, before it's drawn.

Check for that.

It's only being created once, if that's what you mean.
Logged

some_damn_canadian

Re: [GML]Unwanted speed increase at room warp.
« Reply #11 on: April 07, 2006, 11:58:42 pm »
I just spent the past two hours looking at this stuff... and I found nothing...
The only ting that I could put my finger on, is the speed never changes. So it has to be some other variable(s). It might be the x and y variables getting messed up and not the speed. =/
Logged

Ben

Re: [GML]Unwanted speed increase at room warp.
« Reply #12 on: April 08, 2006, 01:39:44 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 437
Send me the code, and I'll be happy to have a look, and hopefully tell you whats wrong.
Logged
Want a place to upload your sprites and games for FREE? Look no further than GameDevotion
Re: [GML]Unwanted speed increase at room warp.
« Reply #13 on: April 08, 2006, 10:00:11 pm »
  • The Broken King
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1259
The fact that this problem hasn'tbeen solved yet is somewhat intriguing to me, actually. Send me a copy so I can take a look too please.
Logged
  • Broken Kings [Temp Site]

some_damn_canadian

Re: [GML]Unwanted speed increase at room warp.
« Reply #14 on: April 08, 2006, 11:54:52 pm »
The fact that this problem hasn'tbeen solved yet is somewhat intriguing to me, actually. Send me a copy so I can take a look too please.

I'm not suprised at all... there are like, a billion files. =| And I could only find one that was activated with the change of every room. And all that one does is change which room you'll go to when going where ever. =/ The one main thing that I found out and found wierd was that the speed doesn't change at all. >.<
Logged
Re: [GML]Unwanted speed increase at room warp.
« Reply #15 on: April 09, 2006, 12:32:07 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 121
is there anything in the room that uses the same variable.
Logged

some_damn_canadian

Re: [GML]Unwanted speed increase at room warp.
« Reply #16 on: April 09, 2006, 02:04:03 am »
is there anything in the room that uses the same variable.

I don't think it's a global variable that is the issue but a local one.
Logged

Gyrowolf

Re: [GML]Unwanted speed increase at room warp.
« Reply #17 on: April 09, 2006, 06:58:42 am »
I'm not suprised at all... there are like, a billion files. =| And I could only find one that was activated with the change of every room. And all that one does is change which room you'll go to when going where ever. =/ The one main thing that I found out and found wierd was that the speed doesn't change at all. >.<

There might be a couple of files that I didn't filter out when zipping them. Namely, the map_warp.gml file and many unused sprite images. I apologise about that. :P

is there anything in the room that uses the same variable.

I don't think it's a global variable that is the issue but a local one.

Any script in particular?
Logged
Re: [GML]Unwanted speed increase at room warp.
« Reply #18 on: April 09, 2006, 07:16:36 am »
  • The Broken King
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1259
I figured it out and fixed it.

I'll send the file to you after...

for the reference of those that may encounter similar problems, the issue is that he loaded the script every time the player was created.
This accumulated, so that the step even that causes the player to move 2 frames per second loaded every time the object was created. So that after the object was created twice, it had this code twice, and therefore, executed it twice. And so on.

The solution was like this:

Code: [Select]
if(!global.player_loaded)
{
    execute_file(dir_obj+'cm_obj.dat');
    global.player_loaded = true;
}

Then I set global.player_loaded to false in the starting room (he may want to change that later).
Logged
  • Broken Kings [Temp Site]

Gyrowolf

Re: [GML]Unwanted speed increase at room warp.
« Reply #19 on: April 09, 2006, 08:06:18 am »
Wow that was quick!

Thank you very much! Out of curiosity, where was the script being executed the second time?
Logged
Pages: [1] 2   Go Up

 


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



Page created in 0.127 seconds with 74 queries.

anything