Flash Website Builder- Trendy Site Builder is a Flash Site Building tool that helps users build stunning websites. Check Out Custom Custom Logo Design by LogoBee. Website Design and Free Logo Templates available.
 CodingForums.com Multiple images moving different directions

Before you post, read our: Rules & Posting Guidelines

Enjoy an ad free experience by logging in. Not a member yet? Register.
 11-08-2012, 01:46 PM PM User | #31 salutsalut New to the CF scene   Join Date: Nov 2012 Posts: 8 Thanks: 0 Thanked 0 Times in 0 Posts I have found this Code: ```with instance_create( x+lengthdir_x(80,image_angle), y+lengthdir_y(80,image_angle),obj_bullet) { xspeed=lengthdir_x(10,other.image_angle) yspeed=lengthdir_y(10,other.image_angle) }``` or this one Code: ```with instance_create( x+lengthdir_x(80,image_angle), y+lengthdir_y(80,image_angle),obj_bullet) { xspeed=cos(other.image_angle*pi/180)*10 //convert degrees to radians when using these yspeed=-sin(degtorad(other.image_angle))*10 //i think the y component needs to be flipped }``` but I can't match it with your code.
 11-08-2012, 08:38 PM PM User | #32 Old Pedant Supreme Master coder!     Join Date: Feb 2009 Posts: 24,941 Thanks: 75 Thanked 4,305 Times in 4,272 Posts *sigh* Okay look at that code: Code: ```if ( x==0 || x==xmax || y==0 || y==ymax ) { bug.xspeed = - bug.xspeed; bug.yspeed = - bug.yspeed; }``` That can be read as "if EITHER the x or y position reaches EITHER the smallest or largest allowed value, then reverse the direction of BOTH the x and y movement." CLEARLY that is NOT what you want. You want to reverse the x direction if x reaches the limits and *separately* reverse the y direction if y reaches the limits. So very very simply: Code: ```if ( x==0 || x==xmax ) { bug.xspeed = - bug.xspeed; } if ( y==0 || y==ymax ) { bug.yspeed = - bug.yspeed; }``` TRY IT! __________________ An optimist sees the glass as half full. A pessimist sees the glass as half empty. A realist drinks it no matter how much there is.
 11-09-2012, 01:18 AM PM User | #33 salutsalut New to the CF scene   Join Date: Nov 2012 Posts: 8 Thanks: 0 Thanked 0 Times in 0 Posts thank you, it works perfectly. I will learn javascript one day, I promise.
 11-09-2012, 02:01 AM PM User | #34 Old Pedant Supreme Master coder!     Join Date: Feb 2009 Posts: 24,941 Thanks: 75 Thanked 4,305 Times in 4,272 Posts Now where in the world did you find that picture of me? Of course, that was taken some time ago, while I still had a little hair on my head. (On the back; it doesn't show in that picture.) __________________ An optimist sees the glass as half full. A pessimist sees the glass as half empty. A realist drinks it no matter how much there is.

 Bookmarks

 Tags images, javascript, move, multi, school

 Thread Tools Rate This Thread 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 On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home :: Client side development     JavaScript programming         DOM and JSON scripting         Ajax and Design         JavaScript frameworks         Post a JavaScript     HTML & CSS     XML     Flash & ActionScript         Adobe Flex     Graphics and Multimedia discussions     General web building         Site reviews         Building for mobile devices :: Server side development     Apache configuration     Perl/ CGI     PHP         Post a PHP snippet     MySQL         Other Databases     Ruby & Ruby On Rails     ASP     ASP.NET     Java and JSP     Other server side languages/ issues         ColdFusion         Python :: Computing & Sciences     Computer Programming     Computer/PC discussions     Geek News and Humour Web Projects and Services Marketplace     Web Projects         Small projects (quick fixes and changes)         Medium projects (new script, new features, etc)         Large Projects (new web application, complex features etc)         Unknown sized projects (request quote)         Vacant job positions         Looking for work/ for hire         Project collaboration/ partnership         Paid work offers and requests (Now CLOSED)     Career, job, and business ideas or advice     Domains, Sites, and Designs for sale         Domains for sale         Websites for sale         Design templates and graphics for sale :: Other forums     Member Offers     Forum feedback and announcements

All times are GMT +1. The time now is 01:29 AM.