The Enchanted Cave 2
Delve into a strange cave with a seemingly endless supply of treasure, strategically choos
4.39 / 5.00 38,635 ViewsGhostbusters B.I.P.
COMPLETE edition of the interactive "choose next panel" comic
4.09 / 5.00 15,161 ViewsIt's late at night and I'm having trouble thinking...
Simple AS2.0 problem...
if (_root.submachine=2;){
//what would I put here so that when the "2" key is pressed... this.gotoAndStop(2);
}
thanks guys =] i should really get some sleep but my friend keeps bugging at me to get on with this game so yeah... don't want to dissapoint =p
umm...
if(Key.isDown(2)){
That SHOULD work.
At 7/31/08 05:31 PM, Super-Yombario wrote: umm...
if(Key.isDown(2)){
That SHOULD work.
I thought it should be:
if(Key.isDown(Key.2)){
That's what I'd have done...it certainly works for moving MCs. eg.
onClipEvent(enterFrame) {
if(Key.isDown(Key.RIGHT)) {
this._x+=5
}
}
Not sure why I included that code, but I felt that it proved my point...your code may work too, and if it does, its better...
if (_root.submachine==2){
First off, you need to use '==' because your checking a value,
and you need to get rid of the semicolon, you don't need it inside of there.
Here's the whole thing:
onEnterFrame = function() {
// That makes this check perform on every frame
if (_root.submachine == 2) {
if(Key.isDown(2)){
gotoAndStop(2);
}
}
} what
At 7/31/08 05:31 PM, Super-Yombario wrote: umm...
if(Key.isDown(2)){
That SHOULD work.
okay so now I have:
if (_root.submachine=2;){if(Key.isDown(2)){
this.gotoAndStop(2);}}
which is probably right, it looks wrong to me but im too tired to think properly) but now it says i'm missing a ')' somewhere... *cough*.......... ermmmm......... yeah..... help please! xD
also in case anyone says it, yes i do know that i *might* have to change the 2 with the keycode for the 2 key... i probably sound like a general dick like now but i dont care because i dont even know what im typing =D
At 7/31/08 05:31 PM, Super-Yombario wrote: if(Key.isDown(2)){
That SHOULD work.
Lol the keycode for the 2 key is not 2, 2 is the keycode for the right mouse button.
Anyways moose, here's the right code:
if (_root.submachine==2){
//what would I put here so that when the "2" key is pressed... this.gotoAndStop(2);
if (Key.isDown(50)) {
gotoAndStop(2);
trace("Your pressing 2");
}
}
Here's the list of keycodes :)
thanks guys, mixed up a few of your answers. i was screwing up on small things like the semicolon and whatnot... but yeah all fixed now thanks to everyone that lended a helping hand =]
At 7/31/08 05:39 PM, zrb wrote: Lol the keycode for the 2 key is not 2, 2 is the keycode for the right mouse button.
Shit, that means my code is wrong!
I barely know any of the key codes, so i just
assumed what he said was correct.
Should have done my homework :[
Here's the damn thing, OP.
onEnterFrame = function() {
if (_root.submachine == 2) {
if (Key.isDown(50)) {
gotoAndStop(2);
}
}
} what
At 7/31/08 05:45 PM, mooseisloose wrote: thanks guys, mixed up a few of your answers. i was screwing up on small things like the semicolon and whatnot... but yeah all fixed now thanks to everyone that lended a helping hand =]
Out of curiosity, what exactly were you trying to do ?
Prevent right-clicking or an action for the "2" key on the keyboard ?