Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- onClipEvent(load){
- velx = 0
- vely = 0
- speed = 2
- fric = 1
- cap = 6
- gravi = 10
- jump = 40
- }
- onClipEvent(enterFrame){
- if(Key.isDown(65)){
- velx -= speed
- }
- if(Key.isDown(68)){
- velx += speed
- }
- if(Key.isDown(87)){
- if(hitTest(_root.plat)){
- if(vely == 0){
- vely -= jump
- }
- }
- }
- //y
- if(vely > 0){
- vely -= gravi
- }
- //if(vely < 0){
- //vely += gravi
- //}
- //x
- if(velx > 0){
- velx -= fric
- }
- if(velx < 0){
- velx += fric
- }
- //x cap
- if(velx > cap){
- velx = cap
- }
- if(velx < (0 - cap)){
- velx = (0 - cap)
- }
- //y cap
- //if(vely > cap){
- //vely = cap
- //}
- //if(vely < (0 - cap)){
- //vely = (0 - cap)
- //}
- //no drift
- if(velx < .1 && velx > 0){
- velx = 0
- }
- if(vely < .1 && vely > 0){
- vely = 0
- }
- //if(hitTest(
- //gravity
- if(!this.hitTest(_root.plat)){
- vely += gravi
- }
- trace(hitTest(_root.plat))
- this._y += vely
- this._x += velx
- }
Advertisement
Add Comment
Please, Sign In to add comment