PDA

View Full Version : [platform]Mixing coins and scrolling?



Boogie
March 14th, 2005, 11:48 AM
Hey,

I'm currently making a platform game but i'm stuck. I have the following:
- a character (hero)
- a ground to walk on (platform)
- scrolling (thanks to JoMan)

Everything works fine. Now i want to add coins to my game. Here is where it goes wrong. Where do i place the coin's Movieclip?
The coins have to stay in place on the platform (where i placed them). So when the platform scroll's the coins scroll's to. This can be achieved by placing them in the platform movieclip. But once i did that the coins became a part of the platform, so now the character can stand on the coins, which is not part of the plan. :-/

In a few words: coin has to move when te game scroll's. But may not become a platform.

Thnx

bombsledder
March 14th, 2005, 02:09 PM
i dont know ur exact script which would help but u dont gotta place it in the platform place it as _root by it self and if the we say


if(Key.isDown(Key.RIGHT)){
platform._x-=3
coin._x-=3
}
//something like this

Boogie
March 14th, 2005, 03:52 PM
Thnx for trying to help!

This is a sample of the walking code:


function EnterFrame()
{
if (Key.isDown(Key.RIGHT))
{
this._x += this.speed;
this.gotoAndStop("runningright");
facingDirection = "right";
}


and this is a sample of the scrolling code (from JoMan):


function scrolling() {
if (Key.isDown(Key.RIGHT)) {
if (_x>=400) {
_x = 400;
scrollSpeed = 10;
speed = 0;
platform._x -= scrollSpeed;
} else {
speed = 10;
}

In the current code the hero walks the first bit and at 400pixels the platform wil do the moving and the speed of de hero wil be set to 0.

Maybe it's better to start right away with the scrolling and skip the walking of the hero?

mixedtrigeno
March 14th, 2005, 05:39 PM
that can easily be solve just make another mc and name it firstlevel or whatever you want and put your platform mc in it and then just put your coins in there...