Home Tutorials Forums Articles Blogs Movies Library Employment Press

 ActionScript.org Forums rotation on a slope
 Register FAQ Members List Social Groups Calendar Search Today's Posts Mark Forums Read

 08-21-2012, 01:57 AM #1 bryser1 Registered User   Join Date: Nov 2010 Posts: 11 rotation on a slope hey guys, I have some rotation code for a slope: _________________________________________ function onEnterFrame() { var leftist:Object = {xlank.leftdot._x, ylank.leftdot._y} plank.leftdot.localToGlobal(leftist); var rightist:Object = {xlank.rightdot._x, ylank.rightdot._y} plank.rightdot.localToGlobal(rightist); plank._x = _xmouse; plank._y = _ymouse; if (hill.hitTest(leftist.x, leftist.y, true)) {left = true;} else {left = false;} if (hill.hitTest(rightist.x, rightist.y, true)) {right = true;} else {right = false;} if (right == true && left == false) {plank._rotation-=2; trace("right only");} else if (right == false && left == true) {plank._rotation+=2; trace("left only");} else if (right == false && left == false) { trace("neither only");} else if (right == true && left == true) { trace("both only");} lefty._x = (leftist.x); lefty._y = (leftist.y); righty._x = (rightist.x); righty._y = (rightist.y); } __________________________________________ when I changed the name 'plank' to 'guyOnHorse' using the code below, the gravity, pulls the whole lot off the bottom of the screen: _________________________________________ onClipEvent (load) { speed = 3.6; gravity = 0; r = _height/29; jumping = false; var scale:Number = _xscale; jumpheight = 11; running = false; var touchingGround = false; } onClipEvent (enterFrame) { if (Key.isDown(Key.RIGHT)) { _xscale = +scale; if(touchingGround == true) { this.gotoAndPlay("walk"); } _x += Walkspeed; } if (Key.isDown(Key.LEFT)) { _xscale = -scale; if(touchingGround == true) { this.gotoAndPlay("walk"); } _x -= Walkspeed; } else { if (touchingGround == true) { this.gotoAndPlay("still"); } } if (Key.isDown(Key.UP) && !jumping) { gravity = -jumpheight; jumping = true; this.gotoAndPlay("jump"); } if (!_root.ground.hitTest(_x, _y, true)) { gravity++; _y += gravity; touchingGround = false; } else { jumping = false; gravity = 0; } while (_root.ground.hitTest(_x, _y-1+r, true)) { gravity = 0; jumping = false; _y--; touchingGround = true; } } Is there anyone who can help, thankyou kindly in advance! bryser

 Thread Tools Display Modes Rate This Thread Linear Mode Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is Off HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home ActionScript Forums Group     ActionScript 3.0     ActionScript 2.0     ActionScript 1.0 (and below)     Simple Stuff (Newbies) Flash General Questions     Flash 10 General Questions     Flash 9 General Questions     Flash 8 General Questions     Other Flash General Questions Flex     Flex 2, 3 & 4     Flex 1 Extensions and Plugins     Components     JSFL - Extending Flash Desktop, Mobile and non-browser Environments     AIR (Apollo)     FlashLite / Portable Devices Development     Projectors and CDs Supporting Technologies     HTML and JavaScript     haXe     Server-Side Scripting     Flash Remoting     Flash Media Server General     Best Practices     Gaming and Game Development     Animation and Effects     Flashants Support Forum Community Boards     General Chat     Just for Kicks Challenges     Detention Flash In Action     Site Check     Cool Sites     Widgets Decommissioned     Projects and Positions CMS Forums     Announcements Board     Content Postings / Updates     Product Review Requests     CMS Technical Questions     Process Questions     Collaboration & Suggested Articles

All times are GMT. The time now is 05:51 PM.

///