# If statement help please

**URL:** <https://forum.kirupa.com/t/if-statement-help-please/188934>\
**Category:** Uncategorized\
**Created:** [May 11, 2006, 10:28pm UTC](https://forum.kirupa.com/t/if-statement-help-please/188934 "2006-05-11T22:28:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dhryn](https://avatars.discourse-cdn.com/v4/letter/d/47e85d/32.png) [@Dhryn](https://forum.kirupa.com/u/Dhryn)\
**Post date:** [May 11, 2006, 10:28pm UTC](https://forum.kirupa.com/t/if-statement-help-please/188934/1 "2006-05-11T22:28:55Z")

</div>

I know this is possible, but I dont know how.

can some one please show me how to write an if statement so that if the character is in the top quater of the screen then something happens, I can write the then something happens part.

If possible would like it writen on a movie clip, so not in function form.

any help would be great.

---

<div class="post-metadata">

**Author:** ![DangerousDan](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@DangerousDan](https://forum.kirupa.com/u/DangerousDan)\
**Post date:** [May 11, 2006, 11:24pm UTC](https://forum.kirupa.com/t/if-statement-help-please/188934/2 "2006-05-11T23:24:54Z")

</div>

uhh yeah rather easy actually…

```php
 onClipEvent(enterFrame){
if(this._y <= oneHalfOfScreen){ /* Replace oneHalfOfScreen with whatever half the height of the screen is...*/
Action Go here
}
}

```

That’s for the top half the screen, the code goes in the movieclip. For one quarter of the screen just change the number to whatever.

---

<div class="post-metadata">

**Author:** ![Dhryn](https://avatars.discourse-cdn.com/v4/letter/d/47e85d/32.png) [@Dhryn](https://forum.kirupa.com/u/Dhryn)\
**Post date:** [May 11, 2006, 11:47pm UTC](https://forum.kirupa.com/t/if-statement-help-please/188934/3 "2006-05-11T23:47:39Z")

</div>

thankyou, I think there is a code ‘function’ thing that is designed for this job, I never thought of doing it like this, thank you very much. Do you want to be listed in the credits?

---

<div class="post-metadata">

**Author:** ![DangerousDan](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@DangerousDan](https://forum.kirupa.com/u/DangerousDan)\
**Post date:** [May 12, 2006, 12:35am UTC](https://forum.kirupa.com/t/if-statement-help-please/188934/4 "2006-05-12T00:35:25Z")

</div>

uhh, go ahead and add my name :player: I hope the game works out for you.
