# A.I. Jumps

**URL:** https://forum.kirupa.com/t/a-i-jumps/266173
**Category:** programming
**Created:** [July 16, 2008, 11:30pm UTC](https://forum.kirupa.com/t/a-i-jumps/266173 "2008-07-16T23:30:37Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Sidar](https://avatars.discourse-cdn.com/v4/letter/s/c67d28/32.png) [@Sidar](https://forum.kirupa.com/u/Sidar)
#### Post date: [July 16, 2008, 11:30pm UTC](https://forum.kirupa.com/t/a-i-jumps/266173/1 "2008-07-16T23:30:37Z")

</div>

I looked but did not find it so if this question is already asked please redirect me.

Hi im new here so hi…

Question:  
Working in Flash CS3 with AS 3, I’m trying to make a character Jump as soon it detects there is no “platform” or there is a higher “platform” in the next few pixels.

The “character” walks in the direction of the mouse, but i want it to jump on its own. I know i can add a Keyboard event but that will destroy the whole purpose of my idea.

So if any one has a clue …its all welcome.

also im using this code for the platform collision( AND IT SUCKS =( )

private function Collide() {  
y+= \_YV  
;  
while (\_PLATFORM.hitTestPoint(x,y-1,true)) {  
y-=1 ;  
}  
while (\_PLATFORM.hitTestPoint(x+width/2,y-1,true)) {  
x-=1;  
}  
while (\_PLATFORM.hitTestPoint(x-width/2,y-1,true)) {  
x+=1 ;  
}

(Im working with OOP)

Thanks in advance,

Sidar
