L
Larry P
Guest
I’m working on learning Actionscript 2.0 in Flash 8 Pro and am working on a game to help me learn it in a practical, hands on sense. However I am running into a few problems.
The game is a basically a side scroller (art based due to simplicity), where the main character can walk left and right, and slightly walk up and down, then there is a border that boxes in the stage and has information on it (this moves with the character when he walks). Then there are doors along the background that are supposed to lead to different scenes when you are in front of them and are pressing space.
I’m having issues with the doors leading to different scenes. At the moment I’m using the hitTest method, here is what is coded on the door:
onClipEvent (enterFrame) {
if (this.hitTest(_root.char) && Key.getAscii() == 32) {
_root.gotoAndStop("wonderland", 1);
}
}
Char is the instance name of the character and wonderland is the name of the scene I want it to be direct to. This script however does not work. So I tried this:
onClipEvent (enterFrame) {
if (_root.char.hitTest(this._x, this._y, true) && Key.getAscii() == 32) {
_root.gotoAndStop("wonderland", 1);
}
}
And still nothing.
If anyone has any idea how I could make it so that the character has to be touching the door AND space must be down and it’d go to the other scene that’d be great.
Just for experimenting, I made a button that directed to the scene, and it worked in a sense. However, due to the location of the character not being his starting location, I assume, the second scene was way off on the x plane, how would I fix this as well?
The game is a basically a side scroller (art based due to simplicity), where the main character can walk left and right, and slightly walk up and down, then there is a border that boxes in the stage and has information on it (this moves with the character when he walks). Then there are doors along the background that are supposed to lead to different scenes when you are in front of them and are pressing space.
I’m having issues with the doors leading to different scenes. At the moment I’m using the hitTest method, here is what is coded on the door:
onClipEvent (enterFrame) {
if (this.hitTest(_root.char) && Key.getAscii() == 32) {
_root.gotoAndStop("wonderland", 1);
}
}
Char is the instance name of the character and wonderland is the name of the scene I want it to be direct to. This script however does not work. So I tried this:
onClipEvent (enterFrame) {
if (_root.char.hitTest(this._x, this._y, true) && Key.getAscii() == 32) {
_root.gotoAndStop("wonderland", 1);
}
}
And still nothing.
If anyone has any idea how I could make it so that the character has to be touching the door AND space must be down and it’d go to the other scene that’d be great.
Just for experimenting, I made a button that directed to the scene, and it worked in a sense. However, due to the location of the character not being his starting location, I assume, the second scene was way off on the x plane, how would I fix this as well?