PDA

View Full Version : Making a game like Winterbells



fatboyslim007
June 13th, 2008, 01:18 PM
Hey,
I'm trying to make a game like Winterbells (http://www.ferryhalim.com/orisinal/g3/bells.htm). In about an hour I made a prototype (with super fugly graphics). I'm trying to get the gameplay good before I concentrate on the graphics.


This is what I have (http://sites.google.com/site/markloika/Home/Monkey_Swing.swf?attredirects=0). (Less than 1 kilobyte!)


As you might notice, once the ball gets higher the red jumpy things come down faster. The problem is when the ball is lower on the screen the red jumpy things move down slower and that makes your jump height lower. When the ball is up near the top it can skip 2 to 3 balls in a single jump, when it's lower it can't even skip 1 ball. This is happening because I base the movement of the red jumpy things off of how far the ball is from a line about 200 pixels up from the bottom. I just can't figure out a way to do it differently. I want to be able to jump and skip the same number of red springy things for every jump.


This is my code:




gravity = .6;
jump = 10;
force = 10;
randomized = false;
done = 0;
ceiling = 40;

bell_mc.onEnterFrame = function ()
{
lineDistance = bell_mc._y - 450;
lineDistance /= 30;
lineDistance *= -1;

var springArray:Array = new Array(spring1, spring2, spring3, spring4,
spring5, spring6, spring7, spring8,
spring9, spring10, spring11, spring12,
spring13, spring14, spring15, spring16);
for (var k = 0; k < springArray.length; k++)
{
// sets the game up for play
if (randomized == false)
{
springArray[k]._x = random (600) + 25;
springArray[k]._y = 650 - (100 * k);
done += 1;
if (done == springArray.length)
{
randomized = true;
}
}

if (springArray[k]._y > 800)
{
springArray[k]._y -= 1600;
springArray[k]._x = random (600) + 25;
springArray[k]._visible = true;
}

if (springArray[k].hitTest(bell_mc))
{
jump = force;
springArray[k]._visible = false;
springArray[k]._x = 800;
}
springArray[k]._y += lineDistance;
}

if (bell_mc._y < ceiling)
{
bell_mc._y = ceiling;
}
xMouse = _root._xmouse;
if(Math.abs(xMouse - this._x) < 1)
{
this._x = xMouse;
} else
{
this._x -= (this._x-xMouse) / 6;
}
bell_mc._y -= jump;
jump -= gravity;

if (bell_mc. _y > 480)
{
bell_mc._y = 480;
jump = 0;
}
}
bell_mc.onMouseDown = function ()
{
jumping = true;
}
bell_mc.onMouseUp = function ()
{
if (jumping == true)
{
bell_mc._y = 479;
jump = force;
jumping = false;
}
}


Thanks for your help.

rrh
June 13th, 2008, 03:03 PM
I guess you shift the rabbit an equal amount to how far you shift everything else.

One simple way of doing that is to put them all inside a container movieClip, and then move that movieClip up and down to always show the rabbit. Of course, you could also just move the rabbit in addition to all the bells.