# Multiple ground isntances using Arrays \[Help please\]

**URL:** <https://forum.kirupa.com/t/multiple-ground-isntances-using-arrays-help-please/319623>\
**Category:** flash\
**Created:** [February 26, 2011, 11:38pm UTC](https://forum.kirupa.com/t/multiple-ground-isntances-using-arrays-help-please/319623 "2011-02-26T23:38:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JoeyMaru](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@JoeyMaru](https://forum.kirupa.com/u/JoeyMaru)\
**Post date:** [February 26, 2011, 11:38pm UTC](https://forum.kirupa.com/t/multiple-ground-isntances-using-arrays-help-please/319623/1 "2011-02-26T23:38:13Z")

</div>

Hello everyone!

I’ve been browsing this forum for a long time, and I wanted to make an account so I could actually communicate with it’s members. 🙂

Currently I’m working on a game engine with a friend of mine, we plan to make it open source so other people can use it too for their own games…

We basically have everything done, but I really want to add multiple ground instance support.

To get more in-depth…

I would like to use an Array, to call upon all ground layers on the stage, and put it into one call name for my gravity function. So I wouldn’t have to have various strings for each ground instance.

I know I’m probably no where close… but this is my attempt.

```auto
var groundArray:Array = [ground, ground2, ground3];
var groundtile:MovieClip = groundArray[1];
addChild(groundtile);

```

This is my gravity…

```auto
function heroGravity(e:Event) {				
	if (jumping) { 							
		Suoh.y -= yspeed; 					
		if (Suoh.hitTestObject(groundtile)) {
			jumping = false; 				
			inAir = false;					
			Suoh.gotoAndStop("Stand")		
		}
	}											
	Suoh.y -= yspeed;							
	if (!Suoh.y < groundtile.y && jumping == true) {
		yspeed -= gravity;
	}
	if (Suoh.hitTestObject(groundtile)) {
		Suoh.y = groundtile.y;
	}
}
	if (!Suoh.hitTestObject(groundtile)) {   
		yspeed -= yacceleration;                     
	}
	if (!Suoh.y < groundtile.y) {
		yspeed -= yacceleration;
}

```

What I have so far works perfect without arrays…  
When I add my above array, I don’t get any errors… but I fall through the ground. ☹

Would anyone mind helping me?  
I’ve been trying at this for quite some time now and I can’t seem to nail it…
