# Scrolling

**URL:** <https://forum.kirupa.com/t/scrolling/58608>\
**Category:** Uncategorized\
**Created:** [July 24, 2004, 12:10am UTC](https://forum.kirupa.com/t/scrolling/58608 "2004-07-24T00:10:59Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![elPooter](https://avatars.discourse-cdn.com/v4/letter/e/839c29/32.png) [@elPooter](https://forum.kirupa.com/u/elPooter)\
**Post date:** [July 24, 2004, 12:10am UTC](https://forum.kirupa.com/t/scrolling/58608/1 "2004-07-24T00:10:59Z")

</div>

Konichi wa, Fellow Kirupans!

I need help developing a scrolling terrain and backround for my game. In my other games, I have always used this wimpy coding for scrolling:

```php
 
onClipEvent (enterFrame) {
	if (_root.hero._x>268.4) {
		_root.backround._x -= 2;
		_root.terrain._x -= 2;
		_root.hero._x -= 2;
	   }
	if (_root.hero._x<44.5) {
		_root.backround._x += 2;
		_root.terrain._x += 2;
		_root.hero._x += 2;
	  }
	if (_root.hero._y>189.4) {
		_root.backround._y -= 3;
		_root.terrain._y -= 3;
		_root.hero._y -= 3;
	  }
	if (_root.hero._y<-2.6) {
		_root.backround._y += 3;
		_root.terrain._y += 3;
		_root.hero._y += 3;
	  }
}

 

```

…And I HATE that coding :ogre:. If anyone can help, that would be great. Thanks in advance!

```
-elPooter.
```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 24, 2004, 1:38am UTC](https://forum.kirupa.com/t/scrolling/58608/2 "2004-07-24T01:38:56Z")

</div>

```php

onClipEvent(EnterFrame) {
this.gamebottom = -300;
this.gametop = 600;
this.gameleft = -750;
this.gameright = 0; 
this.vx = 0;
this.ax = -250;
this.vy = 300;
this.ay = 0;
this.force = 0.07;
this.damping = 0.70;
}

```

```php

onClipEvent(EnterFrame) {
this.ax = (_root.gamebase.char._x+_root.gamebase._x-375)*this.force;
this.vx += this.ax;
this.vx *= this.damping;
this.ay = (_root.gamebase.char._y+_root.gamebase._y-190)*this.force;
this.vy += this.ay;
this.vy *= this.damping;
this._x -= this.vx;
this._y -= this.vy;
 if (this._x>this.gameright) {
  this._x = this.gameright 
 }
 if (this._x<this.gameleft) {
  this._x = this.gameleft 
 }
  if (this._y>this.gametop) {
  this._y = this.gametop 
 }
 if (this._y<this.gamebottom) {
  this._y = this.gamebottom 
 }
}

```

This is the code on my last game (before I switched to one-framing it). It’ll require some modification.

Unless I’m mistaken, you will need this on the background clip, and just have some code on the terrain clip taht duplicates the \_x and \_y of the background clip.

In my game, the player character was created in the gamebase mc, and the gamebase mc is the background and levelly stuff, so the real \_x coordinates are relative to the gamebase mc. I’m not sure how yours is rigged, so I can’t offer any more help.

the 375 is the x centre of my movie, and 190 is below the y centre of the movie, you’ll have to alter these to match your movie.

mess around with force and damping until you get the speed you want.

Hope this is of some use.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 24, 2004, 2:02am UTC](https://forum.kirupa.com/t/scrolling/58608/3 "2004-07-24T02:02:39Z")

</div>

Arigato! Thank you :hugegrin: Ill experiment with that.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 24, 2004, 4:15am UTC](https://forum.kirupa.com/t/scrolling/58608/4 "2004-07-24T04:15:17Z")

</div>

Nihongo ga dekimasu ka!?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 24, 2004, 4:48am UTC](https://forum.kirupa.com/t/scrolling/58608/5 "2004-07-24T04:48:03Z")

</div>

Hai! Nihongo ga skoshi Wakarimasu. Nihongo ga sogon na desu! doi suru ne?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 24, 2004, 5:50am UTC](https://forum.kirupa.com/t/scrolling/58608/6 "2004-07-24T05:50:38Z")

</div>

Nan to osshaima\*\*\*\*a ka? (sogon, suru, doi) Sono kotoba wa shirimasen!? o\_O?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 24, 2004, 6:23am UTC](https://forum.kirupa.com/t/scrolling/58608/7 "2004-07-24T06:23:01Z")

</div>

@.@ Oroo…Nihongo muzukashii desu ne!

…Watashi no nihongo warui desu yo! \>.\<

-Ja-ne

PS. I like your flippy guy! lol  
=^-^=

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 24, 2004, 12:56pm UTC](https://forum.kirupa.com/t/scrolling/58608/8 "2004-07-24T12:56:23Z")

</div>

Ok, if I said something bad in japanese, I would have no clue! Im a beginer at japanese.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 24, 2004, 1:12pm UTC](https://forum.kirupa.com/t/scrolling/58608/9 "2004-07-24T13:12:38Z")

</div>

Hey _saru_, what did you say when you said:

Nan to osshaima\*\*\*\*a ka? (sogon, suru, doi) Sono kotoba wa shirimasen!? o\_O?

and

Nihongo ga dekimasu ka!?

I thought you asked me if I understood japenese.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 25, 2004, 5:27pm UTC](https://forum.kirupa.com/t/scrolling/58608/10 "2004-07-25T17:27:16Z")

</div>

you guys used alot of words in japanese ive never heard of…did you spell them right because they are not even coming up in my japanese translator…@.@

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 25, 2004, 5:48pm UTC](https://forum.kirupa.com/t/scrolling/58608/11 "2004-07-25T17:48:22Z")

</div>

I just look up the words in my book.
