Be a Supporter!

scrolling background

  • 360 Views
  • 12 Replies
New Topic Respond to this Topic
Re2deemer
Re2deemer
  • Member since: Nov. 3, 2005
  • Offline.
Forum Stats
Member
Level 13
Blank Slate
scrolling background 2006-06-04 05:45:28 Reply

I have this game, where the background is about 2500x2500. The player can rotate itself 360 and then move the way the MC is facing. How can I make the background follow it?


BBS Signature
RyanPridgeon
RyanPridgeon
  • Member since: Dec. 7, 2005
  • Offline.
Forum Stats
Member
Level 11
Blank Slate
Response to scrolling background 2006-06-04 05:47:33 Reply

At 6/4/06 05:45 AM, Re2deemer wrote: I have this game, where the background is about 2500x2500. The player can rotate itself 360 and then move the way the MC is facing. How can I make the background follow it?

Make everything inside a movieclip, then put this AS on it

onClipEvent(enterFrame){
this._x=-player._x+Stage.width/2;
this._y=-player._y+Stage.height/2;
}

that will make it follow an mc with the instance name 'player'


I make flashes because I can.
PM me for anything flash or web related or visit my blog!!

BBS Signature
GustTheASGuy
GustTheASGuy
  • Member since: Nov. 2, 2005
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to scrolling background 2006-06-04 05:47:36 Reply

Here's a hint: if the player goes right, the background should then go left, eh?
If you go up, background goes down.
Go figure it out.


BBS Signature
RyanPridgeon
RyanPridgeon
  • Member since: Dec. 7, 2005
  • Offline.
Forum Stats
Member
Level 11
Blank Slate
Response to scrolling background 2006-06-04 05:48:37 Reply

At 6/4/06 05:47 AM, -Gust- wrote: Here's a hint: if the player goes right, the background should then go left, eh?
If you go up, background goes down.
Go figure it out.

Ha! for once YOU have the bad way of doing it! <3


I make flashes because I can.
PM me for anything flash or web related or visit my blog!!

BBS Signature
Re2deemer
Re2deemer
  • Member since: Nov. 3, 2005
  • Offline.
Forum Stats
Member
Level 13
Blank Slate
Response to scrolling background 2006-06-04 05:55:39 Reply

At 6/4/06 05:47 AM, RyanPridgeon wrote:
Make everything inside a movieclip, then put this AS on it

onClipEvent(enterFrame){
this._x=-player._x+Stage.width/2;
this._y=-player._y+Stage.height/2;
}

that will make it follow an mc with the instance name 'player'

nahh...didn't work...


BBS Signature
GustTheASGuy
GustTheASGuy
  • Member since: Nov. 2, 2005
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to scrolling background 2006-06-04 05:59:19 Reply

At 6/4/06 05:48 AM, RyanPridgeon wrote: Ha! for once YOU have the bad way of doing it! <3

Doing what? Giving hints?


BBS Signature
Re2deemer
Re2deemer
  • Member since: Nov. 3, 2005
  • Offline.
Forum Stats
Member
Level 13
Blank Slate
Response to scrolling background 2006-06-04 09:19:12 Reply

At 6/4/06 05:59 AM, -Gust- wrote:

Doing what? Giving hints?

onClipEvent (enterFrame) {
if(Key.isDown(Key.RIGHT)) {
this._x=_x-10;
}
}
onClipEvent (enterFrame) {
if(Key.isDown(Key.LEFT)) {
this._x=_x+10;
}
}

onClipEvent (enterFrame) {
if(Key.isDown(Key.UP)) {
this._y=_y-10;
}
}
onClipEvent (enterFrame) {
if(Key.isDown(Key.DOWN)) {
this._y=_y+10;
}
}

Did you mean a code like this? if you did, then you gave a wrong hint. read the question carefully, especcially the part about my MC


BBS Signature
javi-kunti
javi-kunti
  • Member since: Mar. 25, 2006
  • Offline.
Forum Stats
Member
Level 11
Blank Slate
Response to scrolling background 2006-06-04 09:39:26 Reply

the game... is metal slug type

Re2deemer
Re2deemer
  • Member since: Nov. 3, 2005
  • Offline.
Forum Stats
Member
Level 13
Blank Slate
Response to scrolling background 2006-06-04 10:04:48 Reply

Nooo....!
http://bay01.imageba..w=4588_Onslaught.swf

a simple example


BBS Signature
Re2deemer
Re2deemer
  • Member since: Nov. 3, 2005
  • Offline.
Forum Stats
Member
Level 13
Blank Slate
Response to scrolling background 2006-06-04 10:06:54 Reply

At 6/4/06 10:04 AM, Re2deemer wrote: Nooo....!
http://bay01.imageba..w=4588_Onslaught.swf


a simple example

my bad....WASD to move


BBS Signature
GustTheASGuy
GustTheASGuy
  • Member since: Nov. 2, 2005
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to scrolling background 2006-06-04 10:42:26 Reply

No, I didn't read it wrong. It was you who took my hint wrong.

Okay, here's a bigger hint:
If the player goes up by 3.452367 and right by 2.744761, then relatively the rest goes 3.452367 down and 2.744761 left.
Any better? -_-


BBS Signature
Re2deemer
Re2deemer
  • Member since: Nov. 3, 2005
  • Offline.
Forum Stats
Member
Level 13
Blank Slate
Response to scrolling background 2006-06-04 11:38:00 Reply

no, because i'm a n00b at AS


BBS Signature
Re2deemer
Re2deemer
  • Member since: Nov. 3, 2005
  • Offline.
Forum Stats
Member
Level 13
Blank Slate
Response to scrolling background 2006-06-05 04:49:32 Reply

i really could use some help at this...


BBS Signature