Glitch with spawned item going wrong way

Hi there. This has only happened to me twice out of the thousands of times I've been testing my game as I've been creating it, but this is totally weird, and obviously it doesn't happen very often at all. It's the sort of thing that a player might think is a part of the game if it happened to them, but I would prefer it not ;)

In my game I have an obstacle that spawns randomly from the right side of the screen and moves to the left, and the player has to get over it. 99.9% of the time this works perfectly, however in that .1% of the time, in the middle of the game that same obstacle will suddenly appear on the left side of the screen and slowly move to the right, as though chasing the player (this is an endless runner). During this, the obstacle keeps spawning from the right just like it's supposed to. It's kindof interesting, but it's something that I can't pin down how it could have happened because I don't have any code that's telling the object to spawn on that side of the screen or to move to the right. Is it a previously spawned object that's being sent back before it hit my 'destroy' wall that I have off screen? Any ideas as to what's going on and how to fix it?

Thanks!

Comments

  • IceboxIcebox Member Posts: 1,485

    @mcholman@yahoo.com said:
    It's kindof interesting, but it's something that I can't pin down how it could have happened because I don't have any code that's telling the object to spawn on that side of the screen or to move to the right. Is it a previously spawned object that's being sent back before it hit my 'destroy' wall that I have off screen? Any ideas as to what's going on and how to fix it?

    No one can tell you whats wrong if they cant see your code.. Its like saying my car wont work , any idea as to whats going on ? ... just an example ( not trying to be rude) .. you need to provide more details , it might be something with your logic

  • SocksSocks London, UK.Member Posts: 12,822

    Like Icebox says all we can do is guess . . . you have a bunch of rules, behaviours, attributes, conditions (etc) that produce the result you are getting, you are asking people to attempt to reverse-engineer all that code in their heads just from a description of the result the code produces !

    Once they have reverse-engineered the code (and assuming they have guessed exactly how you have it set up) they then need to mentally scan it looking for mistakes !!

    And like Icebox says, I'm not trying to be rude either, just pointing out the near impossible task this involves . . . just giving a description of the result of a process is no easier in maths, if I were to say I have a large sprawling mathematical equation that should produce the number 628.3, but instead produces 622.5, would you be able to tell me where in my equation I've gone wrong !? :)

    Hope that makes sense !!

    So, to track down an issue with your code we would need to see your code.

  • mcholman@yahoo.commcholman@yahoo.com Member, PRO Posts: 6



    I think I might have figured it out, now that I'm looking at it. I don't know why it would be doing what it is, but I think it's possible that it's not destroying the object because I had it say to destroy the object when its position equals -200 rather than when it is less than -200.

  • mcholman@yahoo.commcholman@yahoo.com Member, PRO Posts: 6

    Whoops, just tested it after changing it and it did it again, so that's not it.

Sign In or Register to comment.