# Newbie Collision Problem

**URL:** https://forum.kirupa.com/t/newbie-collision-problem/267955
**Category:** flash
**Created:** [August 7, 2008, 3:24pm UTC](https://forum.kirupa.com/t/newbie-collision-problem/267955 "2008-08-07T15:24:46Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Pygma](https://avatars.discourse-cdn.com/v4/letter/p/7c8e57/32.png) [@Pygma](https://forum.kirupa.com/u/Pygma)
#### Post date: [August 7, 2008, 3:24pm UTC](https://forum.kirupa.com/t/newbie-collision-problem/267955/1 "2008-08-07T15:24:46Z")

</div>

Hello Kirupa Community,

am pretty new to Kirupa and Flash.

I have a little problem, concerning a character hitting a wall. 🙂

What i have: a char that can jump and move around by the arrow keys.

What i need: character shall stop movement if he hits a geometry. But being able to start movement again, besides through the geometry. I´d like to reach this with gskinners CheckForCollision class. Have a look here: [http://www.gskinner.com/blog/archives/2005/10/source\_code\_sha.html](http://www.gskinner.com/blog/archives/2005/10/source_code_sha.html) But i didnt manage my code to get it work. So maybe you could leak me some information on how to get this done.

Heres my code so far:

```auto
onClipEvent (load)
	{

		ymove = 0;
		xmove = 0;
		power = 5;
		gravity = 0.95;
		friction = 0.85;
		jumpForce = 5;
		jumping = false;
		
	}

onClipEvent (enterFrame)
	{

		
import com.gskinner.sprites.CollisionDetection;
if (CollisionDetection.checkForCollision(this,level,255))
			{	
				xmove = 0 / friction;
				ymove = 0 - gravity;
				
			}
		
		
		if (jumping)
			{	
				power = 1;
				ymove -= jumpForce;
				jumping = false;
			}
				
		if (Key.isDown(Key.LEFT))
			{
				xmove -= power;
			}
			
		if (Key.isDown(Key.RIGHT))
			{
				xmove += power;
			}
			
		if (Key.isDown(Key.UP))
			{
				jumping = true;
			}
			
			
		
		xmove *= friction;
		ymove += gravity;
		_y += ymove;
		_x += xmove;

	}

```

edit admits: so far i have a character mc called “player” and one called “level”.  
i would apply the code to the player, and it would be cool to have the possibility to check collision of the player with multiple MCs, not only the level.

I´d appreciate any kind of help concerning this problem.

Thx in advance and greets  
😉 Pygma
