View Full Version : How make my scene move.
dflame
May 7th, 2006, 10:22 PM
I have my scene : 500 px width and my backround about 1000 px width. How move my character over this 500 px and see him on my backround ?
www.dflame.net/ermac3.swf
Dhryn
May 8th, 2006, 04:30 AM
Can you explain that a bit better please
dflame
May 8th, 2006, 06:32 AM
Hi sorry for my englisch. Lets start 1 more. I have 'ermac' when you press arows you move him. My scene have 500 px width. And my backround have 1000 px width. I want to move my ermack over this 500 px. Now when i move him over 500 px he moves over the stage and i dont see him.
nathan99
May 8th, 2006, 06:43 AM
Move the background instead of him;)
dflame
May 8th, 2006, 06:47 AM
haha go better pls show me ; )
nathan99
May 8th, 2006, 07:03 AM
if(Key.isDown(Key.LEFT)){
_root.background._x += 5
}
etc
dflame
May 8th, 2006, 07:17 AM
yyeye but when you go to midle of stage and press LEFT or RIGHT you gonna see white scene backround and my backroung gonna move left ever and ever
nathan99
May 8th, 2006, 07:22 AM
if(Key.isDown(Key.LEFT) && _root.background.getBounds(_root).xMin<0){
_root.background._x += 5
} else if(Key.isDown(Key.RIGHT) && _root.background.getBounds(_root).xMax>Stage.width){
_root.background._x -= 5
}
Dhryn
May 8th, 2006, 08:26 AM
or if you want the character to move and not the background you could use the code from this following file.
35805
35806
If your not botherd on which code to use, then I would suggest using nathan's code.
dflame
May 8th, 2006, 05:20 PM
Hmm ok i giv You a SWF of some car. I want make my stage and 'ermac' like this car. http://www.dflame.net/car.swf
Dhryn how make my guy to go over MY Scene and i want see him.
Dhryn
May 8th, 2006, 05:25 PM
sorry, I dont understand the question
dflame
May 8th, 2006, 05:45 PM
The car width are 550 px and height 400 px. When i move him over scene i stiil can see him.
Dhryn
May 8th, 2006, 06:07 PM
can you post a fla file please, would be easier to understand, plus I can edit the code for you to show you what I mean, thats if I can make it work.
optixburn
May 8th, 2006, 06:08 PM
think he wants us to tell him how once he gets his character to the edge of the "viewable scene" the background moves while the character is still on the scene
right wrong ... you know like the zelda games where you get to a certain point on the screen and the world moves where you don't ... or a fighting game ... once the character gets close to the edge of the screen the background changes because he's "moving forward"
maybe that'll help explain it better ... *shrug*
dflame
May 8th, 2006, 06:12 PM
Thanks optixburn this is exactly what i want to do.
nathan99
May 8th, 2006, 06:18 PM
if(Key.isDown(Key.LEFT)){
if(_root.background.getBounds(_root).xMin<0){
_root.background._x += 5;
} else if(this.getBounds(_root).xMin>0) {
this._x -= 5;
}
} else if(Key.isDown(Key.RIGHT)){
if(_root.background.getBounds(_root).xMax>Stage.width){
_root.background._x -= 5
} else if(this.getBounds(_root).xMax<Stage.width) {
this._y += 5;
}
}
like that?
Dhryn
May 8th, 2006, 06:22 PM
sorry, I think I know what you mean, this tutorial should help.
http://www.flashkit.com/tutorials/Games/Building-David_Do-610/index.php
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.