You are not logged in.
Announcement
#1 18/01/08 10:08pm
Either here or flash games...
I'll post it here as I can't get done if its the wrong place because it isn't directly releasted to flash games.
Why doesn't the following code work?
Zuriki's failure code wrote:
onClipEvent(load){
var xspeed = 5
var slide = 0
}
onClipEvent(enterFrame){
if(Key.isDown(Key.RIGHT)){
this._x = this._x + xspeed + slide;
slide = slide + 0.1;
}else{if(!Key.isDown(Key.RIGHT)){
this._x = this._x + slide;
slide = slide - 0.1;
}
if(Key.isDown(Key.LEFT)){
this._x = this._x - xspeed - slide;
slide = slide - 0.1;
}else{if(!Key.isDown(Key.LEFT)){
this._x = this._x - slide;
slide = slide + 0.1;
}
}
}
}
onClipEvent(enterFrame){
if(Key.isDown(Key.RIGHT)){
this._x = this._x + xspeed + slide;
slide = slide + 0.1;
}else{if(!Key.isDown(Key.RIGHT)){
this._x = this._x + slide;
slide = slide - 0.1;
}
}
}
onClipEvent(enterFrame){
if(slide >= 5){
slide = 5;
}else{if(slide <= 0){
slide = slide + 0.1;
}
}
}
onClipEvent(enterFrame){
_root.xs = xspeed
_root.ss = slide
}
PS. The following
Zuriki wrote:
onClipEvent(enterFrame){
_root.xs = xspeed
_root.ss = slide
}
Just prints text to a text box so that just so I know the current value of the slide and xspeed.
Also all of that code is attached to a movieclip.
Also I know the code is messy but tbh I'm just learning so I use alot of onClipEvents... sorry.
EDIT: Also I can't use the Math and Math.floor methods. Please don't use then if possible.
Last edited by Zuriki (18/01/08 10:12pm)
[img]http://img134.imageshack.us/img134/9129/headerxt2.png[/img]
[url=http://zuriki.co.nr/project/traveller/][img]http://i28.tinypic.com/2vspafo.png[/img][/url]
[url=http://zuriki.co.nr]Zuriki - PSP Flash Games[/url]
Offline