00:00
00:00

AS: Scrolling Background

13,434 Views | 54 Replies
New Topic Respond to this Topic

Response to AS: Scrolling Background 2006-02-05 14:37:57


i have a question though, how can you change the script so instead of using arrow keys you could use the mouse to contol the player, with scripted cam? Im bad with mouse scripts

Response to AS: Scrolling Background 2006-02-20 06:11:55


Thx man! im gonna try it!


BBS Signature

Response to AS: Scrolling Background 2006-02-23 22:01:38


Ok wow, I have a solution everyone (except for alot) will find satisfactory, make a tutorial to teach newbs like myself such fun stuff, or better yet will someone add me to thier messanger, and help me (n00b) make a sidescrolling shooter? I can be of some help, and it would be great help even though being a noob can give you cancer I know, however it probally wouldnt be that bad, I can make backgrounds pretty decently, character ok, and environs pretty good as well, just need to get someone who know action script or can teach me step by step. If you have an answer add vgguy99
@hotmail.com or go to my site and start my flash section : www.rolleth.proboards57.com Thanks all GB - Rolleth

Response to AS: Scrolling Background 2006-02-25 12:09:09


How do you make the backround scroll at a slower pace? What variable do you change?

Response to AS: Scrolling Background 2006-02-25 12:11:24


At 2/25/06 12:09 PM, meandthemoon9 wrote: How do you make the backround scroll at a slower pace? What variable do you change?

If you look at the first post:

onClipEvent (enterFrame) {
// When the right key is down, it starts scrolling left.
if(Key.isDown(Key.RIGHT)) {
this._x=_x-10;
}
}
onClipEvent (enterFrame) {
// When the left key is down, it starts scrolling right.
if(Key.isDown(Key.LEFT)) {
this._x=_x+10;
}
}

//You can change the speed (the 10) to whatever you want.

Response to AS: Scrolling Background 2006-03-18 17:49:49


look!!!

click click now

Response to AS: Scrolling Background 2006-04-22 14:24:41


how bout you move the character with the arrow keys, and you move the back round with wasd, so then you can change it at will...

Response to AS: Scrolling Background 2006-04-22 15:49:55


Hey DrDeath, you're kinda dumb.... you don't have to say this._x = _x-whatever. Just put this._x -= whatever number. I'm tired of seeing people do dumb things like that. I also can't stand it when people screw up on the simplest code in the world. Sure, everyone does it sometime, me too, but now I'm pretty good at script and am tired of noobs. DON'T SAY I SUCK BECAUSE ALL MY SUBMISSIONS HAVE LOW SCORES. I HAVEN'T SUBMITTED IN A WHILE. THOSE ARE OLD.

~boney_man


#1286129 // soundcloud.com/1shibumi

BBS Signature

Response to AS: Scrolling Background 2006-04-22 16:17:06


At 4/22/06 03:49 PM, boney_man wrote: Hey DrDeath, you're kinda dumb.... you don't have to say this._x = _x-whatever. Just put this._x -= whatever number.

It's just two different ways of doing the same thing, one slightly shorter. It doesn't make him dumb, just makes you look like an idiot. Some people may prefer doing it the other way, it's a bit like using ?.

Response to AS: Scrolling Background 2006-06-03 17:51:32


aww....in my case the MC rotates and then moves the way the MC is facing. I want the backgroung to follow it though. what would be the code?


BBS Signature

Response to AS: Scrolling Background 2006-07-29 15:08:59


At 12/29/05 11:04 AM, True_Darkness wrote: I think it would be easiest if you were to make the background follow the player and scroll as it does. It's simple.

I did just that. And it already works.

But how do i stop the background from moving once my character moves to the farthest left and farthest right? Just like the one made by Spawn. The Naruto example just a few post above me. ^^

Thanks

Response to AS: Scrolling Background 2006-09-12 11:11:00


how do you make it stop scrolling when you are at the end of the level?


-funny sentence goes here-

Response to AS: Scrolling Background 2006-09-12 11:16:19


At 9/12/06 11:11 AM, crispy21 wrote: how do you make it stop scrolling when you are at the end of the level?

onClipEvent(enterFrame){
if(this._x = INSERT NO. HERE){
this._x = SAME No. AS ABOVE
}
// Same for _y;
}

Basically that..tweak it a bit.

Response to AS: Scrolling Background 2006-09-12 11:53:26


where do i put it?


-funny sentence goes here-

Response to AS: Scrolling Background 2006-09-12 11:56:33


In the background?

That is what you are scrolling right?

or alternatively:

Try this..

Response to AS: Scrolling Background 2006-10-29 01:27:28


How do you make it so when you hittest something, you stop moving altogether, instead of going through it???

Response to AS: Scrolling Background 2006-11-28 16:15:41


how would u do it for a RTS game?

Response to AS: Scrolling Background 2006-11-30 23:33:39


At 12/29/05 11:04 AM, TrueDarkness wrote:
Then on the background just add a script like...
onClipevent(enterFrame){
this._x=_root.player._x/5
}

or you could do the same thing with a scripted camera.
onClipEvent(enterFrame){
this._x=_root.player._x
}

placed on the camera

Response to AS: Scrolling Background 2007-02-17 07:12:42


At 10/29/06 01:27 AM, Glutton wrote: How do you make it so when you hittest something, you stop moving altogether, instead of going through it???

I have absolutly no idea how old this post was, but i was reading threw it trying to teach myself a thing or two cause im still learning. anyway..

to make your character not go through the object you have to just cancel out the movement of the background. if the background is moving at _x +=10 then you want to make flash no that when your touching the wall, _x -=10, that way, your not moving at all, when you touch the wall, your movement is canceled out so your merely stuck in place. sometimes it helps to do 10.1 or something so your character doesnt glitch through the walls, i have had this happen before.

heres the script if you didnt understand my explanation.

onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
this._x = _x-8;
}
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
this._x = _x+8;
}
}
// you want to put that on the background movieclip itself

onClipEvent (enterFrame) {
if (this.hitTest (_root.player)) {
_root.bg._x -= _root.moveSpeed+.1;
}}

"movespeed" is a variable that equals the speed of the background, so if your background moves at 8, you make the "movespeed variable 8. so all its saying is to cancel out the movement of, well your movement in the first place.

the +1 there is something i added because i was glitching through my walls a little bit, this resolved it for me. you however may not want it at first if your doing ok.
hope i helped, or just completely braught back a dead thread... either way o well, i refreshed my own memory on the matter lol.

-Porter

Response to AS: Scrolling Background 2007-11-03 22:25:50


Hey how do you stop create boundaries for the scrolling. I don't make someone to be able to scroll into infinity.

Response to AS: Scrolling Background 2008-01-14 14:15:57


At 11/26/05 07:27 AM, DemitriW wrote: this is good but i want scrolling background for a movie not a game

then why are you posting in a specific game thread?

if you want a scrolling background for a movie just motiontween it, no code required

Response to AS: Scrolling Background 2008-04-26 23:54:10


so wat happens when my character hits a boundary and the background keeps goin??


.

Response to AS: Scrolling Background 2009-02-14 10:41:30


Speaking of scrolling backgrounds and characters moving in place in the middle, I have a small problem : I am making an RPG (bird's-eye-view stuff). I have this code on the background :

onClipEvent (load) {
movespeed = 5;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
_x -= movespeed;
}
if (Key.isDown(Key.LEFT)) {
_x += movespeed;
}
if (Key.isDown(Key.UP)) {
_y += movespeed;
}
if (Key.isDown(Key.DOWN)) {
_y -= movespeed;
} else {
_root.man.gotoAndStop(1);
}
}

And this code on the character :

onClipEvent (load) {
movespeed = 0;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
this.gotoAndStop(2);
_rotation = 90;
_x += movespeed;
}
if (Key.isDown(Key.LEFT)) {
this.gotoAndStop(2);
_rotation = 270;
_x -= movespeed;
}
if (Key.isDown(Key.UP)) {
this.gotoAndStop(2);
_rotation = 0;
_y -= movespeed;
}
if (Key.isDown(Key.DOWN)) {
this.gotoAndStop(2);
_rotation = 180;
_y += movespeed;
}
if (Key.isDown(Key.RIGHT) && Key.isDown(Key.UP)) {
_rotation = 45;
}
if (Key.isDown(Key.LEFT) && Key.isDown(Key.UP)) {
_rotation = 315;
}
if (Key.isDown(Key.RIGHT) && Key.isDown(Key.DOWN)) {
_rotation = 135;
}
if (Key.isDown(Key.LEFT) && Key.isDown(Key.DOWN)) {
_rotation = 225;
}
}

My problem is that the character is only moving diagonally. Any way to fix this? Thanks and hope someone replies! :)


BBS Signature

Response to AS: Scrolling Background 2009-07-02 13:08:33


Even better

onClipEvent(enterFrame){
if(Key.isDown(Key.RIGHT)){
this._x+=5;
_parent._x-=5;
}
if(Key.isDown(Key.LEFT)){
this._x-=5;
_parent._x+=5;
}
if(Key.isDown(Key.UP)){
this._y-=5;
_parent._y+=5;
}
if(Key.isDown(Key.DOWN)){
this._y+=5;
_parent._y-=5;
}
}

:D