# When 'jump' platform jumps down not sprite

**URL:** <https://forum.kirupa.com/t/when-jump-platform-jumps-down-not-sprite/62041>\
**Category:** programming\
**Created:** [August 24, 2004, 12:07pm UTC](https://forum.kirupa.com/t/when-jump-platform-jumps-down-not-sprite/62041 "2004-08-24T12:07:11Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![musashi9](https://avatars.discourse-cdn.com/v4/letter/m/ea666f/32.png) [@musashi9](https://forum.kirupa.com/u/musashi9)\
**Post date:** [August 24, 2004, 12:07pm UTC](https://forum.kirupa.com/t/when-jump-platform-jumps-down-not-sprite/62041/1 "2004-08-24T12:07:11Z")

</div>

Hi im using this cool platform game engine from  
[http://www.gotoandplay.it/\_articles/2003/12/scrolling\_upd.php](http://www.gotoandplay.it/_articles/2003/12/scrolling_upd.php)  
(fla available there)  
but what i want is when you press up to jump ,the sprite wont move at all however the ground will move down  
here is my failed attempt  
[http://www.mn001c7645.pwp.blueyonder.co.uk/game2.html](http://www.mn001c7645.pwp.blueyonder.co.uk/game2.html)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 24, 2004, 1:21pm UTC](https://forum.kirupa.com/t/when-jump-platform-jumps-down-not-sprite/62041/2 "2004-08-24T13:21:47Z")

</div>

dude sorry i dun know ur answer but i have a question for u…

wat did u put for the part of the script which says

herow = \_root.hero.\_width/2;

i dun really understand wat that meens… wat u put for it,

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 24, 2004, 3:42pm UTC](https://forum.kirupa.com/t/when-jump-platform-jumps-down-not-sprite/62041/3 "2004-08-24T15:42:20Z")

</div>

hmm i dont think i touched that  
here is my modified AS

```auto
// 
// 
// This open source fla was created by leighton at [www.leightfgc.com](http://www.leightfgc.com/)
// 
// 
// ----------------------------------------------------------------------------------------------------------------- Misc
stagewidth = 350;
// ----------------------------------------------------------------------------------------------------------------- hero
hero = _root.hero;
herow = _root.hero._width/2;
xSpeed = 3;
buffer = 5;
blah = 22;
dir = "right";
// ------------------------------------------------------------------------------------------------------------ Platform
platform = _root.platform;
_root.platform._visible = false;
// ----------------------------------------------------------------------------------------------------------- Jumping
jumpAmount = 21;
velY = 0;
maxVelY = jumpAmount*-1;
jump = false;
// ----------------------------------------------------------------------------------------------------------- Scrolling
function scrolling() {
platform._y = tiles._y;
for (i=1; i<3; i++) {
if (tiles.t1._currentframe == i) {
platform._x = tiles._x-(stageWidth*(i-1));
}
}
}
// -------------------------------------------------------------------------------------------------------------- Reset
function heroReset() {
for (i=0; i<5; i += 0.5) {
if (platform.hitTest(hero._x, hero._y-2, true)) {
hero._y--;
}
}
}
// ----------------------------------------------------------------------------------------------------------- hero Hit
function stopTheHero() {
for (i=0; i<1; i+= 0.5) {
if (Key.isDown(Key.LEFT)) {
if (platform.hitTest(hero._x-(heroW-blah), hero._y-buffer, true)) {
	hero._x += xSpeed;
}
if (jump) {
	if (platform.hitTest(hero._x-(heroW-blah), hero._y-buffer, true)) {
	 hero._x += xSpeed;
	}
}
}
if (Key.isDown(Key.RIGHT)) {
if (platform.hitTest(hero._x+(heroW-blah), hero._y-buffer, true)) {
	hero._x -= xSpeed;
}
if (jump) {
	if (platform.hitTest(hero._x-(heroW-blah), hero._y-buffer, true)) {
	 hero._x -= xSpeed;
	}
}
}
}
}
// ------------------------------------------------------------------------------------------------------- EnterFrame
this.onEnterFrame = function() {
// ---------------------------------------------------------------------------------------------------- slope down
if (platform.hitTest(hero._x, hero._y+buffer, true)) {
hero._y++;
}
// -------------------------------------------------------------------------------------------------- hero hitTests
stopTheHero();
// -------------------------------------------------------------------------------------------------------- Jumping
if (platform.hitTest(hero._x-((heroW-blah)-5), hero._y, true) || platform.hitTest(hero._x, hero._y, true) || platform.hitTest(hero._x+((heroW-blah)-5), hero._y, true)) {
jump = false;
velY = 0;
} else {
jump = true;
}
if (!jump) {
if (Key.isDown(Key.UP)) {
jump = true;
velY = jumpAmount;
} else {
jump = false;
}
}
if (jump) {
tiles._y += vely--;
platform._y += vely--;
}
if (velY<=maxVelY) {
tiles._y=tiles._y
platform._y=platform._y
}
// --------------------------------------------------------------------------------------------- hero movement
if (dir == "right") {
if (!jump) {
if (Key.isDown(Key.RIGHT)) {
	if (!Key.isDown(Key.LEFT)) {
	 hero._x += xspeed;
	 hero.gotoAndStop("walkRight");
	}
} else {
	hero.gotoAndStop("stillRight");
	if (Key.isDown(Key.LEFT)) {
	 dir = "left";
	}
}
} else {
hero.gotoAndStop("jumpRight");
if (jump) {
	if (Key.isDown(Key.RIGHT)) {
	 hero._x += xspeed;
	}
}
}
}
if (dir == "left") {
if (!jump) {
if (Key.isDown(Key.LEFT)) {
	if (!Key.isDown(Key.RIGHT)) {
	 hero._x -= xSpeed;
	 hero.gotoAndStop("walkLeft");
	}
} else {
	hero.gotoAndStop("stillLeft");
	if (Key.isDown(Key.RIGHT)) {
	 dir = "right";
	}
}
} else {
hero.gotoAndStop("jumpLeft");
if (jump) {
	if (Key.isDown(Key.LEFT)) {
	 hero._x -= xspeed;
	}
}
}
}
if (hero._x-heroW<0) {
hero._x = heroW;
} else if (hero._x+heroW>stagewidth) {
hero._x = stagewidth-heroW;
}
// -------------------------------------------------------------------------------------------------------- scrolling
if (hero._x>200) {
if (tiles._x != -stageWidth) {
if (platform._x>=-(platform._width-stageWidth-xSpeed)) {
	hero._x = 200;
	tiles._x -= xSpeed;
	scrolling();
	if (tiles._x<=-stageWidth) {

	 if (tiles.t1._currentframe<TILES.T1._TOTALFRAMES) p {<> tiles.t1.nextFrame();
	 tiles.t2.nextFrame();
	 tiles._x = 0;
	 }
	}
}
}
}
if (hero._x<150) {
if (tiles._x != 0) {
if (platform._x<=0) {
	hero._x = 150;
	tiles._x += xSpeed;
	scrolling();
	if (tiles._x>=0) {
	 if (tiles.t1._currentframe>1) {
	 tiles.t1.prevFrame();
	 tiles.t2.prevFrame();
	 tiles._x = -stageWidth;
	 }
	}
}
}
}
// ----------------------------------------------------------------------------------------------------- hero reset
heroReset();
};

```

i think this is all i changed

if (jump) {  
tiles.\_y += vely–;  
platform.\_y += vely–;  
}  
if (velY\<=maxVelY) {  
tiles.\_y=tiles.\_y  
platform.\_y=platform.\_y  
}

and

jumpAmount = 21;  
velY = 0;  
maxVelY = jumpAmount\*-1;  
jump = false;

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 25, 2004, 4:38am UTC](https://forum.kirupa.com/t/when-jump-platform-jumps-down-not-sprite/62041/4 "2004-08-25T04:38:47Z")

</div>

yo dude with that script u cant like create like things that float in the air eh…

the guy walks right through em

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 25, 2004, 10:38am UTC](https://forum.kirupa.com/t/when-jump-platform-jumps-down-not-sprite/62041/5 "2004-08-25T10:38:33Z")

</div>

float in the air? what are you tralking about  
i want it so when the up key is pressed the floor moves down then eases back up  
i have almost done it but it (see my example) doesnt work 100% ,the floor doesnt come up all the way

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 25, 2004, 11:34am UTC](https://forum.kirupa.com/t/when-jump-platform-jumps-down-not-sprite/62041/6 "2004-08-25T11:34:38Z")

</div>

> [@musashi9](#):
>
> float in the air? what are you tralking about  
> i want it so when the up key is pressed the floor moves down then eases back up  
> i have almost done it but it (see my example) doesnt work 100% ,the floor doesnt come up all the way

Why dont u ask leight? He’s over on [flashkit.com](http://flashkit.com), he’s a nice guy and im sure he would help u out. Also remember to credit him if u end up finishing the game, its nice to credit people ^.^

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 25, 2004, 3:02pm UTC](https://forum.kirupa.com/t/when-jump-platform-jumps-down-not-sprite/62041/7 "2004-08-25T15:02:05Z")

</div>

ah ok been looking for his emailaddress but it wasnt on any of the sites with his work  
cheers

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 25, 2004, 10:36pm UTC](https://forum.kirupa.com/t/when-jump-platform-jumps-down-not-sprite/62041/8 "2004-08-25T22:36:09Z")

</div>

sweet

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 25, 2004, 10:55pm UTC](https://forum.kirupa.com/t/when-jump-platform-jumps-down-not-sprite/62041/9 "2004-08-25T22:55:34Z")

</div>

man i hate flashkit…

im in “queue” for there moderators so i cant even talk to leight… bah

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 25, 2004, 10:56pm UTC](https://forum.kirupa.com/t/when-jump-platform-jumps-down-not-sprite/62041/10 "2004-08-25T22:56:25Z")

</div>

if anyone know her email please tell me

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 25, 2004, 11:09pm UTC](https://forum.kirupa.com/t/when-jump-platform-jumps-down-not-sprite/62041/11 "2004-08-25T23:09:22Z")

</div>

“queue”? :h:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 25, 2004, 11:10pm UTC](https://forum.kirupa.com/t/when-jump-platform-jumps-down-not-sprite/62041/12 "2004-08-25T23:10:48Z")

</div>

ya i created account… clicked activation… and then it does that

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 25, 2004, 11:15pm UTC](https://forum.kirupa.com/t/when-jump-platform-jumps-down-not-sprite/62041/13 "2004-08-25T23:15:11Z")

</div>

Personally, I didnt like flashkit all that much either. I dunno why, I just didnt.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 27, 2004, 10:01am UTC](https://forum.kirupa.com/t/when-jump-platform-jumps-down-not-sprite/62041/14 "2004-08-27T10:01:19Z")

</div>

hmmm i signed up and talked to him/her right away

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 27, 2004, 12:53pm UTC](https://forum.kirupa.com/t/when-jump-platform-jumps-down-not-sprite/62041/15 "2004-08-27T12:53:47Z")

</div>

A queue is a line, same thing.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 27, 2004, 1:25pm UTC](https://forum.kirupa.com/t/when-jump-platform-jumps-down-not-sprite/62041/16 "2004-08-27T13:25:28Z")

</div>

i would ask him for u but my stupid MSN isnt working. And flashkit is one of the best sites on the web, why wouldnt u like it?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 27, 2004, 5:56pm UTC](https://forum.kirupa.com/t/when-jump-platform-jumps-down-not-sprite/62041/17 "2004-08-27T17:56:06Z")

</div>

> [@elPooter](#):
>
> “queue”? :h:

a queue is a line of people

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 27, 2004, 10:24pm UTC](https://forum.kirupa.com/t/when-jump-platform-jumps-down-not-sprite/62041/18 "2004-08-27T22:24:31Z")

</div>

> [@johnredcorn](#):
>
> yo dude with that script u cant like create like things that float in the air eh…
> 
> the guy walks right through em

He means, there is no handling for the top of the character hitting the bottom of a wall. You can’t make overhangs or floating platforms that work right with the current script.
