Jump to content

? servers

? players online

Need help with actionscript :(

Recommended Posts


  • Content Count:  2686
  • Joined:  03/22/08
  • Status:  Offline

Basically, I have the following code put in to one frame. When I try to make the tiles move, everything moves, including the ball and the background?Why aren't the other objects stationary?Help please!

 

PS:I have no idea where to post these kind a coding problems :d. But this sub-forum seems a good place :)

 

//stop level
stop();
//väärtused
var kiirus:Number = 3;

//build level
level = new Array();
_root.attachMovie("taevas1","taevas1",1);
_root.createEmptyMovieClip("tiles",2);
level[0] = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0);

for (y=0; y
for (x=0; x
	if (level[y][x] == 1) {

		ehita = tiles.attachMovie("normalTile", "normal_"+tiles.getNextHighestDepth(), tiles.getNextHighestDepth(), {_x:x*100, _y:y*100});

	}

}

}

//spawn player
_root.attachMovie("player","player_uus",_root.getNextHighestDepth(),{_x:35, _y:35});

//pos
tiles._x = 220;
tiles._y = 240;
player_uus._x = 220;
player_uus._y = 240;
//movement
tiles.onEnterFrame = function() {

if (Key.isDown(Key.LEFT)) {
	_x += kiirus;
}
if (Key.isDown(Key.UP)) {
	_y += kiirus;
}
if (Key.isDown(key.RIGHT)) {
	_x -= kiirus;
}
if (Key.isDown(key.DOWN)) {
	_y -= kiirus;
}
};

Link to comment

  • Content Count:  111
  • Joined:  07/06/08
  • Status:  Offline

Fixed it ..

 

 

//build level
level = new Array(. )( .) _root.attachMovie("taevas1","taevas1",1);
_root.createEmptyMovieClip("tiles",2);
level[0] = new Array(1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0);

for (y=0; y
for (x=0; x
if (level[y][x] == 0) {

Link to comment

  • Content Count:  2686
  • Joined:  03/22/08
  • Status:  Offline

Righty, I got it fixed now.

 

tiles.onEnterFrame = function() {

if (Key.isDown(Key.LEFT)) {
	player_uus._x += kiirus;
}
if (Key.isDown(Key.UP)) {
	player_uus_y += kiirus;
}
if (Key.isDown(key.RIGHT)) {
	player_uus_x -= kiirus;
}
if (Key.isDown(key.DOWN)) {
	player_uus_y -= kiirus;
}
};

Link to comment

  • Content Count:  111
  • Joined:  07/06/08
  • Status:  Offline

Righty, I got it fixed now.

 

tiles.onEnterFrame = function(. Y .) {

if (Key.isDown(Key.LEFT)) {
	player_uus._x += kiirus;
}
if (Key.isDown(Key.UP)) {
	player_uus_y += kiirus;
}
if (Key.isDown(key.RIGHT)) {
	player_uus_x -= kiirus;
}
if (Key.isDown(key.DOWN)) {
	player_uus_y -= kiirus;
}
};

 

told ya .. the boobies help

Link to comment

Reply to Thread

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...