dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: scrolling background

  1. #1
    ninja army recruiter
    Join Date
    May 2008
    Location
    Austin, TX
    Posts
    6

    scrolling background

    so i've got the scrolling background thing down for a side-scroller im making, but eventually i want to have the background image change from a wall to an outside scene, by changing the artwork as you walk along. i tried this but it's not working:

    Code:
    if (Key.isDown(Key.RIGHT)) {
    			if (crouching == false) {
    				wall._x -= 10;
    				walking = true;
    				player_mc.gotoAndStop("walk");
    				if (wall._x<=800) {
    					walliteration++;
    					if (walliteration == 2) {
    						wall.gotoAndStop("transition");
    						transition = true;
    					}
    					if (transition == true) {
    						wall.gotoAndStop("wall2");
    						walliteration -= 50;
    					}
    					wall._x = 1600;
    				}
    			}
    walliteration is supposed to change to different frames of the background after the wall scrolls past you a few times, but it's not changing.

  2. #2
    ninja army recruiter
    Join Date
    May 2008
    Location
    Austin, TX
    Posts
    6
    i figured it out- this is the new code:

    //walk button
    if (Key.isDown(Key.RIGHT)) {
    if (crouching == false && attack == false) {
    if (mobattack == true && back == false) {
    if (transition == true) {
    wall.walltransition._x += 10;
    } else {
    wall._x += 10;
    }
    }
    if (transition == true) {
    wall.walltransition._x -= 10;
    } else {
    wall._x -= 10;
    }
    walking = true;
    player_mc.gotoAndStop("walk");
    if (transition == true) {
    if (wall.walltransition._x<=-5600) {
    wall.walltransition._x = -2400;
    }
    } else {
    if (wall._x<=800) {
    walkpoints++;
    if (walkpoints>=4) {
    wall.gotoAndStop("transition");
    transition = true;
    walkpoints = 0;
    }
    wall._x = 1600;
    }
    }
    }
    i reduced it from 3 different images to 2, and just used the MC within the first wall MC for the second one.

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