# Stick RPG Grand Theft Auto

**URL:** <https://forum.kirupa.com/t/stick-rpg-grand-theft-auto/241364>\
**Category:** flash\
**Created:** [October 12, 2007, 5:32pm UTC](https://forum.kirupa.com/t/stick-rpg-grand-theft-auto/241364 "2007-10-12T17:32:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![GUNITRICH](https://avatars.discourse-cdn.com/v4/letter/g/838e76/32.png) [@GUNITRICH](https://forum.kirupa.com/u/GUNITRICH)\
**Post date:** [October 12, 2007, 5:32pm UTC](https://forum.kirupa.com/t/stick-rpg-grand-theft-auto/241364/1 "2007-10-12T17:32:37Z")

</div>

Ok im making an rpg game that is kind of like grand theft auto. I figured out how to make the character go through doors and move around and rotate too. By the way its a birds eye view game with 3d buildings. One thing i cant figure out is how if i hit a building a character will stop right there. With the script i have now when he goes up to the building he doesnt go through it but the buidling still moves and it pushes the character with it. Here is the actions i have on the character

onClipEvent (load){movespeed = 0;  
}  
onClipEvent (enterFrame) {  
if (Key.isDown(Key.RIGHT)) {  
play();  
\_rotation = 90;  
\_x+= movespeed;  
}  
if (Key.isDown(Key.LEFT)) {  
play();  
\_rotation = 270;  
\_x-= movespeed;  
}  
if (Key.isDown(Key.UP)) {  
play();  
\_rotation = 0;  
\_y-= movespeed;  
}  
if (Key.isDown(Key.DOWN)) {  
play();  
\_rotation = 180;  
\_y+= movespeed;  
}  
if (Key.isDown(Key.RIGHT) && Key.isDown(Key.UP)) {  
\_rotation = 45;  
}  
if (Key.isDown(Key.LEFT) && Key.isDown(Key.UP)) {  
\_rotation = 315;  
}  
if (Key.isDown(Key.RIGHT) && Key.isDown(Key.DOWN)) {  
\_rotation = 135;  
}  
if (Key.isDown(Key.LEFT) && Key.isDown(Key.DOWN)) {  
\_rotation = 225;  
}  
}onClipEvent (load) {  
power = 0;  
radius = 6;  
}  
onClipEvent (enterFrame) {  
if (Key.isDown(Key.LEFT)) {  
\_x -= power;  
}  
if (Key.isDown(Key.RIGHT)) {  
\_x += power;  
}  
if (Key.isDown(Key.UP)) {  
\_y -= power;  
}  
if (Key.isDown(Key.DOWN)) {  
\_y += power;  
}  
while (\_root.wall.hitTest(\_x, \_y+radius, true)) {  
\_y–;  
}  
while (\_root.wall.hitTest(\_x, \_y-radius, true)) {  
\_y++;  
}  
while (\_root.wall.hitTest(\_x-radius, \_y, true)) {  
\_x++;  
}  
while (\_root.wall.hitTest(\_x+radius, \_y, true)) {  
\_x–;  
}  
}

And here is what i have on the building

onClipEvent (load) {  
movespeed = 3;  
}  
onClipEvent (enterFrame) {  
if (Key.isDown(Key.RIGHT)) {  
\_x-= movespeed;  
}  
if (Key.isDown(Key.LEFT)) {  
\_x+= movespeed;  
}  
if (Key.isDown(Key.UP)) {  
\_y+= movespeed;  
}  
if (Key.isDown(Key.DOWN)) {  
\_y-= movespeed;  
}  
}

I gave the character the instance man and i gave the buildings the instance name wall.  
Does anyone see any flaws in this code? If so please help me out.

Also if anyone wants to help with game i could use some. I would post the swf file on here but i have no clue how… Thanks
