What does this mean for me? You will always be able to play your favorite games on Kongregate. However, certain site features may suddenly stop working and leave you with a severely degraded experience.
What should I do? We strongly urge all our users to upgrade to modern browsers for a better experience and improved security.
We suggest you install the latest version of one of these browsers:
I couldnt help but notice that your “Hero Ship” is allowed to leave the 600 × 300 frame. Can anyone help me make a code to limit the Hero Ships movement to the 600 × 300 frame? It doesnt make sense to allow it to move freely since the enemies self destruct after a certain range so to “Beat” the game all you have to do is go outside the boundary. Thanks for your help.
Okay thanks to the suggestion from Danny\_Phantom\_ I figured out how to make “boundaries” and I thought I’d share my code with others in case they need some direction.
The code below makes it so that if the OBJECT goes beyond the 600 range width of the stage, then the OBJECT is “teleported” back to the position of 600, making it impossible to ever really go pass the 600 range width.
if (\_x \> 600)
\_x = 600
But the above code still allows the OBJECT or “HERO SHIP” to go beyond the point of 0 or go all the way to the left of screen without stopping. To prevent this add the code below. The code below makes it so that when the OBJECT or “HERO SHIP” goes beyond the width of 0 (or all the way to the left) it will “teleport” it back to 0, which never actually lets the OBJECT go beyond 0 or in other words prevents it from scrolling to the left infinitely.
if (\_x \< 1)
\_x = 0
And of course to prevent OBJECT or “HERO SHIP” from scrolling infinitely UP and DOWN, you use the same coding but tweak it to change the \_x to \_y. And example to stop it from scrolling infinitely down is below. Use all that you learned here to make the boundary for preventing your ship to infinitely scroll UP.
if (\_y \> 300)
\_y = 300