# Basic gaming question

**URL:** <https://forum.kirupa.com/t/basic-gaming-question/275275>\
**Category:** programming\
**Created:** [November 12, 2008, 12:56am UTC](https://forum.kirupa.com/t/basic-gaming-question/275275 "2008-11-12T00:56:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kingpin803](https://avatars.discourse-cdn.com/v4/letter/k/e47c2d/32.png) [@kingpin803](https://forum.kirupa.com/u/kingpin803)\
**Post date:** [November 12, 2008, 12:56am UTC](https://forum.kirupa.com/t/basic-gaming-question/275275/1 "2008-11-12T00:56:49Z")

</div>

I’ve just started to learn actionscript 2.0 and I’m in the process of trying to create a simple adventure style game. Basically, i have an character that on keyboard movement will travel from one to room to another (kind of like Zelda). I have it working but I feel I’m doing it the wrong way. For example, I start off in room one and place movie clips for the exit points to others rooms and label them accordingly. I give the character a script…

onClipEvent (enterFrame) {  
if (\_root.character.hitTest(\_root.exitRm2)) {  
\_root.gotoAndPlay(“Room2”);  
}

Once in Room2 I would give the character a script to go back to Room1

onClipEvent (enterFrame) {  
if (\_root.character.hitTest(\_root.exitRm1)) {  
\_root.gotoAndPlay(“Room1”);

It works but the problem is once back to Room1 the character appears in his original starting position and not the entrance point from Room2. I got it working by creating a new frame for the character, named the frame Room1b, and so forth…if that makes any sense. But I’m sure that’s not the correct way.

I’m sure there’s a better way to do this but haven’t found any tutorials on this. Thanks in advance for any help!
