A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: [HELP] Moving Scene

  1. #1
    MSPaint Master
    Join Date
    Dec 2005
    Location
    Texas
    Posts
    71

    [HELP] Moving Scene

    I making a 2-D game I need the code to make it where I have the sprite in the middle of the screen and when I choose these directions the screen moves that direction and the sprite stays in the middle

    forward-W
    backward-S
    left-A
    right-D

    please help


    Ce-Bro Productions, an online game making a web comic community

    Ce-Bro.com

  2. #2
    Hey Timmy!!! walsher's Avatar
    Join Date
    Jan 2005
    Location
    Latrobe, PA
    Posts
    1,899
    just add the code. And change the guy to whatever the background is called

    _root.onEnterFrame = function() {
    if (Key.isDown(Key.UP)) {
    _root.guy._y -= 1;
    }
    if(Key.isDown(Key.DOWN)){
    _root.guy._y+=1
    }
    if(Key.isDown(Key.RIGHT)){
    _root.guy._x+=1
    }
    if(Key.isDown(Key.LEFT)){
    _root.guy._x-=1
    }
    };

  3. #3
    MSPaint Master
    Join Date
    Dec 2005
    Location
    Texas
    Posts
    71
    Expression could not be resolved on line 10 _root.onEnterFrame = function()

    I dont know what happened?


    Ce-Bro Productions, an online game making a web comic community

    Ce-Bro.com

  4. #4
    Hey Timmy!!! walsher's Avatar
    Join Date
    Jan 2005
    Location
    Latrobe, PA
    Posts
    1,899
    Did you but the { on that line. And also in the code I fogot you were using asdw. So change the up to W, down to S, left to A and right to D. Sorry bout that.

  5. #5
    MSPaint Master
    Join Date
    Dec 2005
    Location
    Texas
    Posts
    71
    Im not sure what you mean by
    Did you but the { on that line
    all I did was copy and paste what the code was, and change the keys.


    Ce-Bro Productions, an online game making a web comic community

    Ce-Bro.com

  6. #6
    Hey Timmy!!! walsher's Avatar
    Join Date
    Jan 2005
    Location
    Latrobe, PA
    Posts
    1,899
    Okay, is the code you pasted on the main timeline or on the movieclip?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center