Saturday 15 September 2012

actionscript 3 - Nape Moving Platform -


OK, I am relatively new in the process of making a game and have created a type of platform for IM Kinetic, and I I want to move on stage in a certain range. Can anyone please see where the IM is going, thanks. Enter the private functionframeholder (Eve: Event): Zero {if (movingPlatform.position.x = 260) {movingPlatform.velocity.x - = 10; }}

If you increase the position in one of the blocks .x 10 minus you are deducting from velocity.x 10. I think both of you mean position.x .

Second, imagine movingPlatform.position.x 150 and runs your enterFrameHandler once. movingPlatform.position.x will be 160 and the next time the code is not called enterFrameHandler , if no block will be executed after 160, less than or equal to 150 Equals 150 or more or 260

You can use the velocity to reverse the side while moving on one side while moving ahead of the edge of a motion:

  // assuming velocity ( 1.0) Enter the private functionFramehandler (Eve: Event): Zero {if (Plotting platform.OPTTT = 150 || movingPlatform.position.x> = 260) { MovingPlatform.velocity.x = -movingPlatform velocity.x; } MovingPlatform.position.x + = movingPlatform.velocity.x; }   

Obviously this problem can arise if the object already says x = 100, then it will only keep the speed running, so either make sure you make it 150- It can be a better way to handle speed:

Personal function enterFrameHandler (ev: events) ): Zero {if (movingPlatform.position.x <= 150) {movingPlatform.velocity.x = 1; } And if (movingPlatform.position.x> = 260) {movingPlatform.velocity.x = -1; } MovingPlatform.position.x + = movingPlatform.velocity.x; }

No comments:

Post a Comment