Menu

can somone please help...

2004-11-18
2012-12-25
  • Nobody/Anonymous

    ive been playing with this script i got from another post about automatic scrolling, and i have been tryng to edit it or understand parts of it to make it work like this... once the player has walked to the right and the screen moves forward that you cant walk back wards, the screen only scrolls to the right but not to the left, AND the player cantwalk off screen(to the left) so it acts like a solid wall,(like the first mario bros i think) so far ive just got errors... any help will be much appreciated.

     
    • Ed

      Ed - 2004-11-18

      So basically you want to get rid of the automatic part.  Right?

      Okay, so here's what you do.  Take the original script.

      Basically, what you're going to do is gut the OnAfterMoveSprite sub. Between the
      With ProjectObj.GamePlayer

      and

      End With

      Lines, take almost all of it out.  Leave only this line:

            .rMap.Draw XOff, .MapScrollY

      Now, before that line and after the With line put this:

      if .PlayerSprite.X > XOff + .rMap.ViewWidth - .PlayerSprite.width - 16 then XOff = XOff + 1

      Which will check to see if the player sprite is 16 pixels or less away from the right edge, and if it is, then it will scroll to the right.  You can change the 16 to be a larger number if you want.

      Note that this is not tested, just it should work.

      And make sure the line you add (the if statement) is all on one line.

       
    • Ed

      Ed - 2004-11-18

      Oh, I forgot.  You'll need to add a few more lines after the one you just added.

      If .PlayerSprite.X < .XOff then .PlayerSprite.X = .XOff
      If .XOff + .rMap.ViewWidth > .rMap.MapWidth then .XOff = .MapWidth - .rMap.ViewWidth

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.