# Classic platform problem

**URL:** https://forum.kirupa.com/t/classic-platform-problem/282498
**Category:** Uncategorized
**Created:** [February 23, 2009, 12:06am UTC](https://forum.kirupa.com/t/classic-platform-problem/282498 "2009-02-23T00:06:09Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ryrocks](https://avatars.discourse-cdn.com/v4/letter/r/ba9def/32.png) [@ryrocks](https://forum.kirupa.com/u/ryrocks)
#### Post date: [February 23, 2009, 12:06am UTC](https://forum.kirupa.com/t/classic-platform-problem/282498/1 "2009-02-23T00:06:09Z")

</div>

Hey,  
I have a character on the stage (\_ball\_mc) which you control with the arrow keys. I also have a rectangle movieclip on the stage (this). I want this rectangle movieclip to act as a block platform. ie. When the character jumps ontop of it he can walk across it, if he walks into it from the left he cant move left any further, same with the right side.

These movieclips are not being created at runtime, they are on the stage.

My registration point of the character is bottom right,  
my registration point of the block is top left

I’ve used the following ENTERFRAME with not much luck. Stopping the character from moving any further when he walks into the block seems to be ok. I’m having trouble getting him to land on the block without conflicting with the leftDown and rightDown.

As this is such a common gaming element, I figure there must be some documentation on this ?

```auto

if (_findStageInstances)
			{
				_ball_mc = parent.getChildByName("ball_mc") as MovieClip;
				_findStageInstances = false;
			}
			
			if (_ball_mc.hitTestObject(this) && _ball_mc.x >this.x)
			{
				_ball_mc.rightDown = false;
			}
			if (_ball_mc.hitTestObject(this) && _ball_mc.x > (this.x + this.width))
			{
				_ball_mc.leftDown = false;
				_ball_mc.x +=1; //move ball away from block, otherwise Rdown and Ldown are disabled and it gets stuck
			}
			if (_ball_mc.hitTestObject(this) && _ball_mc.y < this.y)
			{
				_ball_mc.falling = false;
				_ball_mc.jump = false;
				_ball_mc.y = (this.y);
			}

```

Any help would be much appreciated!
