Wednesday, 5 May 2010

Code change.

Alright this is where it gets somewhat awkward, having used actionscript before i knew that every key has it's own "value" for example A is (65) B (67) etc...

When playing the game (if you have) you'll see that the buttons to move up and down are infact Q and A which are a HORRIBLE way to move and play the game.

So i decided to change them to the UP and DOWN arrows. Looked through the code and managed to find this on the movie clip of the paddle.

onClipEvent(load){
spd=20;
}
onClipEvent(enterFrame){
if(Key.isDown(81)and _y>50){
_y-=spd;
}
if(Key.isDown(65)and _y<350){
_y+=spd;
}
}

The bold parts are the most important parts, the 81 and 65 are the values of Q and A. So i changed the values to what i found out from Adobe to be 38 and 40.

The new code looks like this ;

onClipEvent(load){
spd=18;
}
onClipEvent(enterFrame){
if(Key.isDown(38)and _y>50){
_y-=spd;
}
if(Key.isDown(40)and _y<350){
_y+=spd;
}
}


I changed the speed aswell, as the ball seemed almost too quick.

No comments:

Post a Comment