Jump to content


Photo

Monsters keep slowing down


  • Please log in to reply
19 replies to this topic

#1 Listro

Listro

    GMC Member

  • New Member
  • 14 posts
  • Version:GM8

Posted 26 February 2012 - 08:16 PM

I've been making a side scrolling shooting game and most of everything was working correctly and then all of a sudden all the enemy's started walking really slow. After some messing around trying to find out what was wrong it seems the monsters get slower the longer they are alive until they completely stop. I also found out that the step event seems to not work anymore because the sprites should change depending on where the player is. I've worked on it for a couple of hours but couldnt figure it out, if anyone might know why this is happening I'd be grateful. Thanks.
  • 0

#2 Blazingocean

Blazingocean

    GMC Member

  • New Member
  • 27 posts
  • Version:GM8

Posted 26 February 2012 - 08:21 PM

This will probably be caused by incorrect code however it's difficult to help without seeing it. It might have something to do with adding more friction or a collision code. Just check through the step event to make sure you haven't put something as relative if didn't want it to be. As for the sprites changing with the character I can't help without seeing the code you're using.


~Blaze

Edited by Blazingocean, 26 February 2012 - 08:22 PM.

  • 0

#3 Listro

Listro

    GMC Member

  • New Member
  • 14 posts
  • Version:GM8

Posted 26 February 2012 - 08:28 PM

this is the code for one of the monster to simple move towards the man and make the monster look at the man. its in the stop event

move_towards_point(obj_man.x, obj_man.y,4)

if(obj_man.x<x)
{
sprite_index = spr_eye
}
else
{
sprite_index = spr_eyeRight
}

  • 0

#4 TheouAegis

TheouAegis

    GMC Member

  • GMC Member
  • 4705 posts
  • Version:GM8

Posted 26 February 2012 - 08:33 PM

Are you destroying instances once they go outside the view or room? It sounds like you aren't and you're causing a memory leak.

Edited by TheouAegis, 26 February 2012 - 08:33 PM.

  • 0

#5 Listro

Listro

    GMC Member

  • New Member
  • 14 posts
  • Version:GM8

Posted 26 February 2012 - 08:44 PM

No im not because they spawn off screen and move towards the man. The view is a set area so the view doesn't change. The only way to get rid of the monsters is to shoot them.
  • 0

#6 TheouAegis

TheouAegis

    GMC Member

  • GMC Member
  • 4705 posts
  • Version:GM8

Posted 26 February 2012 - 09:23 PM

Post the whole code for the monsters, because that code you posted isn't the problem.
  • 0

#7 Listro

Listro

    GMC Member

  • New Member
  • 14 posts
  • Version:GM8

Posted 26 February 2012 - 09:33 PM

That is the only code for the monster the rest is just drag and drop collision events. i would just put up the whole game but it seems you can attach files on this forum as far as i can tell
  • 0

#8 gman5500

gman5500

    GMC Member

  • New Member
  • 86 posts
  • Version:GM8

Posted 26 February 2012 - 09:43 PM

That is the only code for the monster the rest is just drag and drop collision events. i would just put up the whole game but it seems you can attach files on this forum as far as i can tell

You can upload to media fire, or any other uploading page and then post a link.
  • 0

#9 Listro

Listro

    GMC Member

  • New Member
  • 14 posts
  • Version:GM8

Posted 26 February 2012 - 09:52 PM

totally forgot about that, thanks.

here it is: my game
  • 0

#10 TheouAegis

TheouAegis

    GMC Member

  • GMC Member
  • 4705 posts
  • Version:GM8

Posted 26 February 2012 - 09:55 PM

btw you can post the D&D too. There's a button in the object labeled something like "Show Information" and it will open a popup window with all the D&D and code snippets (some things won't show up but most of that kind of stuff isn't too important).
  • 0

#11 Listro

Listro

    GMC Member

  • New Member
  • 14 posts
  • Version:GM8

Posted 26 February 2012 - 10:05 PM

I messed with it some more and it seems that they move towards the player but its off center. like i could be standing on the far right but the enemies thing im somewhere in the middle area, as soon as i move farther to the left they move to the left also. i don't know if that helps but i though i should say.
  • 0

#12 gman5500

gman5500

    GMC Member

  • New Member
  • 86 posts
  • Version:GM8

Posted 26 February 2012 - 10:07 PM

I messed with it some more and it seems that they move towards the player but its off center. like i could be standing on the far right but the enemies thing im somewhere in the middle area, as soon as i move farther to the left they move to the left also. i don't know if that helps but i though i should say.

okay found the problem and cleaning up code one sec.
  • 0

#13 Listro

Listro

    GMC Member

  • New Member
  • 14 posts
  • Version:GM8

Posted 26 February 2012 - 10:16 PM

Wow that was really fast. You saved me.
  • 0

#14 gman5500

gman5500

    GMC Member

  • New Member
  • 86 posts
  • Version:GM8

Posted 26 February 2012 - 10:43 PM

Wow that was really fast. You saved me.

uh... i am having problems... i have cleaned up the code and down some random stuff to help, but from what i can tell when a enemy toucjes another enemy, is slows down. Whats worse about that is there is NO collision event with other enemys....
  • 0

#15 Listro

Listro

    GMC Member

  • New Member
  • 14 posts
  • Version:GM8

Posted 26 February 2012 - 10:51 PM

do you think it could be something to do with the depth? ive never used it so idk if it would effect something like that
  • 0

#16 Listro

Listro

    GMC Member

  • New Member
  • 14 posts
  • Version:GM8

Posted 27 February 2012 - 12:21 AM

Does anyone know how to fix this problem or run into it before?
  • 0

#17 amiel

amiel

    GMC Member

  • GMC Member
  • 1117 posts
  • Version:Unknown

Posted 27 February 2012 - 01:04 AM

I'm looking on it...Maybe the enemies are not slowing down,maybe the whole/part game?Try to run it on debug mode then look for it's FPS.
:whistle:

Edited by amiel, 27 February 2012 - 01:21 AM.

  • 0

#18 Listro

Listro

    GMC Member

  • New Member
  • 14 posts
  • Version:GM8

Posted 27 February 2012 - 02:11 AM

it doesnt seem to be the fps. its staying at 30 the whole time. One of the monsters moves fine but the others dont yet its the same events and code for them
  • 0

#19 torigara

torigara

    GMC Member

  • GMC Member
  • 6483 posts

Posted 27 February 2012 - 08:08 AM

Try running the game in the debug mode and type in the expression "instance_number(obj_man)". You will realize there are two. Further investigation will reveal that the other one is in fact an instance of obj_display.

The problem appears to be that obj_display has obj_man as the parent (probably set by accident.) When you tell monsters to go toward obj_man, they will look for an instance of obj_man (including child objects), finds obj_display and happily go there. Obj_display is basically invisible but resides to the left of player, so all monsters will end up in piling up on that position.

(Since monsters are told to go to the object diagonally while can only move on a floor, they basically get slower and slower as they come closer to the target's x and eventually stops when their x coordinates come equal.)

By the way, there is other potential issue that a bullet isn't destroyed when it goes out of the room. It will cause other problems if you keep shooting to the sky.

Edited by torigara, 27 February 2012 - 09:01 AM.

  • 0

#20 Listro

Listro

    GMC Member

  • New Member
  • 14 posts
  • Version:GM8

Posted 27 February 2012 - 08:05 PM

Wow im kind of upset that something so little could mess it up that bad. Thanks for the help
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users