# Newbie question!

**URL:** <https://forum.kirupa.com/t/newbie-question/198019>\
**Category:** flash\
**Created:** [August 21, 2006, 8:16pm UTC](https://forum.kirupa.com/t/newbie-question/198019 "2006-08-21T20:16:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![joakinrox](https://avatars.discourse-cdn.com/v4/letter/j/8dc957/32.png) [@joakinrox](https://forum.kirupa.com/u/joakinrox)\
**Post date:** [August 21, 2006, 8:16pm UTC](https://forum.kirupa.com/t/newbie-question/198019/1 "2006-08-21T20:16:30Z")

</div>

hi people! well i have a question im trying to star to lear a little actionscript by making a game so my problem is making the walls to work…

i am trying to use hitest to make walls floor and those things and from what i understand  
if i want my “hero” to detect a colision i should use this:

[COLOR=Red]hero.hitTest(wall)[/COLOR]  
soo this detects that the 2 mc’s are overlapping but how do i make my hero not pass trough the wall?  
perhaps… something like this?  
[COLOR=Red]if (hero.hittest(wall))==true  
x=-10[/COLOR]//wich would be the last position since my speed is ten right?  
but what if it comes from down? or left or from above? how do i make my wall unwalkable from all angles?  
also i would have to write the hittest for each diferent mc i make? that would be WAY to long… isnt there an easier way to detect a colissioN? cuz i’ve also read that hittest really slows down the movie!

AND i have another question(im sure is a very dumb question =P)  
i want my hero to walk(speed=10) and when i press shift to sprint(speed=30)but… when i test the movie i can walk and when i press shift the speed changes to 30… but even after i stop pushing shift the ■■■■ hero keeps moving with 30 of speed! how can i solve this?  
here’s how i’ve got the code:  
[COLOR=Red]onClipEvent(load){  
speed=10;//sets a variable named speed  
}  
onClipEvent(enterFrame){  
if(Key.isDown(Key.SHIFT)){  
speed= 30;

[COLOR=Black]i’ve also tried changing it to this:[/COLOR]  
[/COLOR][COLOR=Red]onClipEvent(enterFrame){  
if(Key.isDown(Key.SHIFT)==true){  
speed= 30;  
Else;  
speed=10  
or this:  
[/COLOR][COLOR=Red] if(Key.isUP(Key.SHIFT)){  
speed= 10;  
[COLOR=Black]  
but none of then work…[/COLOR]  
[COLOR=Black]And finally(last i promess!!!)

could anyone link me a good tutorial to simulate gravity and giving my character the ability to jumP? please?:geek:

thanks in advance for anyhelp some of u geniuses can give me ! =D:geek:  
btw/questions like this should go here or on the game/ai forum?  
[/COLOR][/COLOR][COLOR=Red][COLOR=Black]  
[/COLOR]  
[/COLOR]
