The Enchanted Cave 2
Delve into a strange cave with a seemingly endless supply of treasure, strategically choos
4.34 / 5.00 31,296 ViewsGhostbusters B.I.P.
COMPLETE edition of the interactive "choose next panel" comic
4.07 / 5.00 10,082 Viewsif(Key.isDown (Key.SHIFT)) {
if(jump){
if(!_currentframe==11){
gotoAndStop(11);}}
That's supposed to make it so that whenever you press shift while jumping, it makes you go to frame 11 of the movie clip, but it doesn't work. I have no idea why.
onClipEvent (load) {
jump = false;
scream = false;
s = 6;
this.gotoAndStop(1);
b = this.getBounds(this);
_root.timerID = setInterval(_root.goTime, 10);
function move(x, y) {
h = false;
if (!_root.map.hitTest(_x+x+b.xmin, _y+y+b.ymin, true)) {
if (!_root.map.hitTest(_x+x+b.xmax, _y+y+b.ymin, true)) {
if (!_root.map.hitTest(_x+x+b.xmin, _y+y+b.ymax, true)) {
if (!_root.map.hitTest(_x+x+b.xmax, _y+y+b.ymax, true)) {
_root.map._x -= x;
_root.map._y -= y;
h = true;
}
}
}
}
return h;
}
}
onClipEvent (enterFrame) {
falling = move(0, s);
if (Key.isDown(Key.SPACE) && !falling && !jump) {
jump = true;
vel = -10;
_root.jumpSound.gotoAndPlay(2);
}
if (Key.isDown(Key.LEFT)) {
_xscale = -100;
move(-s, 0);
this.play();
_root.moveSound.gotoAndPlay(2);
}
if (Key.isDown(Key.RIGHT)) {
_xscale = 100;
move(s, 0);
this.play();
_root.moveSound.gotoAndPlay(2);
}
if(Key.isDown (Key.SHIFT)) {
if(jump){
if(!_currentframe==11){
gotoAndStop(11);}}
}
if (jump) {
if (vel<=10) {
h = move(0, vel-s);
if (h == false && vel<0) {
vel *= -1;
}
vel++;
} else {
jump = false;
}
}
if (_root.map._y<-850) {
_root.map._x = 0;
_root.map._y = 0;
scream = false;
}
if (falling) {
gotoAndStop("jump");
} else {
if (_currentframe == 5) {
gotoAndStop(1);
}
}
}
onClipEvent (keyUp) {
this.gotoAndStop(1);
}
That's the full code.
Any suggestions?
"Whoever said 'winners never quit' obviously never considered addicts." - Hoeloe
im not a pro at actionscript but i think the 'if(jump){' is wrong, maybe it should be something like
if jump = true
maybe? :P
fuck
At 11/5/06 01:34 PM, ottermaniac wrote: im not a pro at actionscript but i think the 'if(jump){' is wrong, maybe it should be something like
if jump = true
maybe? :P
actually. its the same!
if you mean
if(jump=true){
At 11/5/06 01:29 PM, uyersuyer wrote: if(Key.isDown (Key.SHIFT)) {
if(jump){
if(!_currentframe==11){
gotoAndStop(11);}}
try
if(!this._currentframe==11){
this.gotoAndStop(11);
}
}
None of this is working. :/
"Whoever said 'winners never quit' obviously never considered addicts." - Hoeloe
if (jump)
and
if (jump == true)
are the same thing.
At 11/5/06 01:36 PM, phyconinja wrote: actually. its the same!
if you mean
if(jump=true){
It's not the same, actually...
if(jump = true)
Assigns the value of true to jump and returns true. You wouldn't use this in practice unless you made a typo.
if(jump)
Executes if jump is equal to or returns true; doesn't execute if jump is equal to or returns false. USE THIS
if(jump == true)
Checks the value of jump, returns true if it is true and returns false if it is false, executing accordingly. You're basically adding an unnecessary comparison when you do this, which is a waste of CPU and line space. There is no real reason to do it.
Try
if(Key.isDown (Key.SHIFT)) {
if(jump){
if(_currentframe<>11){
gotoAndStop(11);}}
At 11/5/06 02:33 PM, Paranoia wrote: if(jump = true)
if(jump == true)
Oh, to elaborate further: It's basically the difference between saying "I like cheese" and "If I like cheese then I like cheese".
Sorry for the double post
but cant u also do this:
if(Key.isDown (Key.SHIFT) && jump ) {gotoAndStop(11);}
that basically makes the move go to frame 11 and stop when shift is pressed and jumping, no matter what frame the movie is currently on.
None of this is workinggggg.
Do I need a different script if I'm publishing in Flash 6 or something? I can't go any higher or it ruins the rest of my code.
"Whoever said 'winners never quit' obviously never considered addicts." - Hoeloe
i just tried the code i gave you out and it works fine for me......
At 11/5/06 01:29 PM, uyersuyer wrote: if(Key.isDown (Key.SHIFT)) {
if(jump){
if(!_currentframe==11){
gotoAndStop(11);}}
That's supposed to make it so that whenever you press shift while jumping, it makes you go to frame 11 of the movie clip, but it doesn't work. I have no idea why.
I haven't read your whole script but if "! " is the instance name I think that's where the issues resides. You can't use that for instance names.
Basicly if you want to use _currentframe you must make it follow the object. Be it this or <instancename> or whatnot.
Try this instead:
if(Key.isDown (Key.SHIFT))
{
if(jump)
{
if(this._currentframe != 11)
{
gotoAndStop(11);
}
}
At 11/5/06 02:33 PM, Paranoia wrote: stuff
sorry.. that was just a typing error!!
Ah, so that's who you are. I've got this covered =D