# Q for Flex

**URL:** <https://forum.kirupa.com/t/q-for-flex/6140>\
**Category:** flash\
**Created:** [September 30, 2002, 5:31pm UTC](https://forum.kirupa.com/t/q-for-flex/6140 "2002-09-30T17:31:03Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![cybergold](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@cybergold](https://forum.kirupa.com/u/cybergold)\
**Post date:** [September 30, 2002, 5:31pm UTC](https://forum.kirupa.com/t/q-for-flex/6140/1 "2002-09-30T17:31:03Z")

</div>

Flex, how would i make a character who can move side to side and can jump, shoot something and an action occuring. In this case, character A shoots something at Character B, i want an action to occur.  
How would i use the Hit.Test method in this case, or with any other method. :-\

---

<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:** [September 30, 2002, 5:39pm UTC](https://forum.kirupa.com/t/q-for-flex/6140/2 "2002-09-30T17:39:08Z")

</div>

Have you checked my site for the running and jumping character? What can you do so far? I can tell you what to add or change etc.

Have you come up with anything?

---

<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:** [September 30, 2002, 5:58pm UTC](https://forum.kirupa.com/t/q-for-flex/6140/3 "2002-09-30T17:58:10Z")

</div>

The other method is tile based - which can reduce the speed of the game - go to [www.edmack.com](http://www.edmack.com) - for a pros and cons list of tile based and art based games.

Are you using one platform, multiple platforms, are you talking about just one level - ie no platforms, side view, overhead view, etc.

If you’re not using tiles, then the ground, or platfrom would be a movie clip to hitTest - so when you jump - when you come down - you keep falling till you hit the ground or platform. But if you have multiple platforms, then you are always falling - unless you have a platform beneath you.

As for the bullets - you need to determine the direction the character is facing then attachMovie or duplicateMovieClip to fire in that direction. And you need to know if you have one bullet at a time, multiple bullets, can you keep the fire button held down etc.

And you need to develop random movements or some sort of decent AI (artificial intelligence) for the enemy or enemies.

You can use \_root.plater\_x or y to determine where they should face or shoot etc.

Like I said let me know what you have so far.

---

<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:** [September 30, 2002, 10:57pm UTC](https://forum.kirupa.com/t/q-for-flex/6140/4 "2002-09-30T22:57:21Z")

</div>

Here you go Flex, all i have are my two characters and nothing else. From the basics I guess. Don’t be surprised at my lack of actionscripting skills. Any help is appreciated. 😏

```
    There are a two actions such as shoot and stand. Two characters, the second has no actions. It will be a floating character, so there doesn't need to be a gravity effect. Here is the FLA.
```

---

<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:** [October 1, 2002, 6:37am UTC](https://forum.kirupa.com/t/q-for-flex/6140/5 "2002-10-01T06:37:53Z")

</div>

I’ve been playing with the fla - I’ll see what I can do…

---

<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:** [October 1, 2002, 8:06am UTC](https://forum.kirupa.com/t/q-for-flex/6140/6 "2002-10-01T08:06:18Z")

</div>

Haven’t had that much of a chance to do anything with it - but this is what I have so far

[http://flex.funkyolive.com/test/gameproject.demo.html](http://flex.funkyolive.com/test/gameproject.demo.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:** [October 1, 2002, 8:22am UTC](https://forum.kirupa.com/t/q-for-flex/6140/7 "2002-10-01T08:22:45Z")

</div>

Nice 😛

---

<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:** [October 1, 2002, 8:26am UTC](https://forum.kirupa.com/t/q-for-flex/6140/8 "2002-10-01T08:26:53Z")

</div>

Thanks ![](http://flex.funkyolive.com/im/cool.gif)

---

<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:** [October 1, 2002, 1:37pm UTC](https://forum.kirupa.com/t/q-for-flex/6140/9 "2002-10-01T13:37:24Z")

</div>

By the way - I’ve added it to the instructions on the swf now. I forgot to mentio to press Up to jump - but it does jump - press Up.

---

<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:** [October 1, 2002, 2:52pm UTC](https://forum.kirupa.com/t/q-for-flex/6140/10 "2002-10-01T14:52:29Z")

</div>

> \*Originally posted by flex \*  
> \*\*Haven’t had that much of a chance to do anything with it - but this is what I have so far

[JKCHR | gallery](http://flex.funkyolive.com/test/gameproject.demo.html) \*\*

Excellent stuff!

Any chance of getting the fla file??

---

<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:** [October 1, 2002, 4:11pm UTC](https://forum.kirupa.com/t/q-for-flex/6140/11 "2002-10-01T16:11:11Z")

</div>

That’s Great Flex ! Almost like you read my mind. Thanks for the help! As you noticed, I only finished the helmet of the other character 😏

---

<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:** [October 1, 2002, 5:56pm UTC](https://forum.kirupa.com/t/q-for-flex/6140/12 "2002-10-01T17:56:56Z")

</div>

Anyone know where i can find a way to get the enemy to be 2nd player, a two player game?  
🙂

---

<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:** [October 1, 2002, 6:26pm UTC](https://forum.kirupa.com/t/q-for-flex/6140/13 "2002-10-01T18:26:59Z")

</div>

Just give him diff controls to the first one. Look on my site a simple maze game where two players compete.

---

<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:** [October 1, 2002, 7:04pm UTC](https://forum.kirupa.com/t/q-for-flex/6140/14 "2002-10-01T19:04:01Z")

</div>

> \*Originally posted by cybergold \*  
> \*\*Anyone know where i can find a way to get the enemy to be 2nd player, a two player game?  
> 🙂 \*\*

You still want my help or… Or have you got the hang of things now?

---

<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:** [October 2, 2002, 1:49am UTC](https://forum.kirupa.com/t/q-for-flex/6140/15 "2002-10-02T01:49:05Z")

</div>

Do you think you could send me the actions and the fla. you worked on 😛 I still don’t know that much AS. So that i can copy what you had for first player, and use those actions to make the second player. the walking/jumping character in your website is not downloadable. But overall thanks for the help.

---

<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:** [October 2, 2002, 2:31am UTC](https://forum.kirupa.com/t/q-for-flex/6140/16 "2002-10-02T02:31:29Z")

</div>

I don’t mind sending the fla - I do it for people all the time - but when you say copy the code for the other player - I’d rather you understood the code or how to do it and then applied it to the other guy. You won’t really have an idea of what’s what in the code just by looking at the fla.

---

<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:** [October 2, 2002, 4:10pm UTC](https://forum.kirupa.com/t/q-for-flex/6140/17 "2002-10-02T16:10:47Z")

</div>

Sorry:o Must have mislead you. I will ofcourse study the AS. That’s the only way i can re apply it to other movies i have. If i wanted to just copy/paste the info, i wouldn’t have gone through this much trouble. :-\ I’m hoping to really learn AS and get a good hang on 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:** [October 3, 2002, 4:14pm UTC](https://forum.kirupa.com/t/q-for-flex/6140/18 "2002-10-03T16:14:28Z")

</div>

can you send up the fla?

---

<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:** [October 3, 2002, 4:25pm UTC](https://forum.kirupa.com/t/q-for-flex/6140/19 "2002-10-03T16:25:58Z")

</div>

what actions go along with the IF. and ELSE. options in the actionscript, what do they do? If i put in a variable for example… chA=10 , would i be able to say \_x=chA+1 (is this how i would get the instance to move a couple of pixels?)

---

<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:** [October 3, 2002, 4:39pm UTC](https://forum.kirupa.com/t/q-for-flex/6140/20 "2002-10-03T16:39:42Z")

</div>

I’m sorting through the flas I have, and tidying up the code I did for you. There is a tut on this site for making an mc move with keys. This how I do it anyway:

on the mc:

```php

onClipEvent (load) {
speed =5;
}

onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
_x -= speed;
} else if (Key.isDown(Key.RIGHT)) {
_x += speed;
}
}

```

That is the simplest way to move the mc, left and right. But you need to add to it to restrict movements so it doesn’t go off stage. And for animations for facing different directions, shooting etc.

There’s no point me going through the code here - it’s all in the fla - I’ll try and comment it as best I can then post it.

EDIT and tip: Putting else’s in certain places can also restrict movement of character - restricting diagonal movement for example.

[Next page](https://forum.kirupa.com/t/q-for-flex/6140.md?page=2)
