Home Tutorials Forums Articles Blogs Movies Library Employment Press

 ActionScript.org Forums Multiple vector forces acting on a forward moving object
 Register FAQ Members List Social Groups Calendar Search Today's Posts Mark Forums Read

 05-12-2008, 09:51 AM #1 lewis_evans Registered User   Join Date: May 2008 Posts: 2 Multiple vector forces acting on a forward moving object LO All, I have been trying to create a platform game using vector calculations for the motion / friction /gravity / bounce etc. All is good - I have a ball bouncing merrily along off my vector floor - until the ball should come to a standstill on the floor due to the friction and lack of bounciness. then the ball just jitters on the surface when I want it to come to a standstill. What I actually want is for the ball not to bounce but stick to the surface. I think it's the gravity vector being added each time making it do this. I know I'm being a bit vague but has anyone ever used vectors for this kind of game and if so do you have any ideas on how I can get my ball to come to rest? Do I have to hack it? Thanks in advance Lewis
 05-12-2008, 12:58 PM #2 ASWC Super Moderator     Join Date: Dec 2007 Location: Greenville, SC Posts: 6,528 that's one way to do it: ActionScript Code: ```var speed:Number = 40; var gravity:Number = 0.9; this.onEnterFrame = function(){     speed*=gravity;     trace(speed)     if(speed<0.01){         gravity=0;         } }``` __________________ aswebcreations Super Duper!
 05-12-2008, 02:30 PM #3 lewis_evans Registered User   Join Date: May 2008 Posts: 2 I'm using vectors for trajectory and gravity and adding them all together. I can't just get rid of gravity. I was needing something more solid. Thanks anyways
 05-12-2008, 03:03 PM #4 MonkeyBiscuits King of the Monkeys   Join Date: Oct 2004 Location: com.utils.house Posts: 319 Use larger values for gravity and speed, then you can use Math.floor on your algorithm to which will reduce any annoyingly small decimals to a flat zero but give you enough scope for decent movement

 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

 Similar Threads Thread Thread Starter Forum Replies Last Post sagra29 Projectors and CDs 3 08-18-2008 04:00 AM matbury ActionScript 3.0 5 12-01-2007 10:05 PM SinisterDesign ActionScript 2.0 4 10-20-2007 05:26 PM hiadam ActionScript 2.0 3 12-12-2006 10:35 PM bitterclarence Animation and Effects 3 04-28-2005 02:18 PM

All times are GMT. The time now is 08:31 PM.

///