The forums have permanently moved to This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.

Results 1 to 2 of 2

Thread: Pushing/Anti-Gravity Wind Effect in AS2

  1. #1

    Pushing/Anti-Gravity Wind Effect in AS2

    Alright guys, so I'm making a game. I want there to be a part where an air vent is pushing against the ball your controlling with your mouse. If you don't get it, check out the swf file from Trust me, it's safe. No download needed.

    As you can see, I've got the idea. That's what I want, the wind pushing the ball and you have to force yourself to push it forward with your arrow/mouse.

    The only thing is there's no variation.

    I want as you get closer to the right side, the wind gets stronger, and the farther you get from the right side, the calmer the wind gets. Here's some basic snipets of the code I used for the wind to react with the ball. This is not the entire code used in the swf.

    //Here's the strength of the gravity.
    gravity = 0.40;
    ball.onEnterFrame = function() {
    //there was some more code here that didn't really have anything to do with the wind.
    xspeed -= gravity;
    I would really appreciate it if you helped! Thanks!

  2. #2
    First off, to give the wind some variation, either try producing a random number for it's strength, or a random delta strength (A small random value you add to the current strength, so the change in strength isn't so sudden).

    Another idea is to have it set on a tween (get the sine of the current frame * Math.PI / 180, which would I guess sort of be a fan pushing wind in gusts (not realistically, but hey, it's a game).

    I guess just have fun with the gravity variable in real time!

    As for the distance thing, just do what you did for the ball pushing, and have the wind strength be something like 1 / distance^2 * gravity (gravity in this case should be huge). That's basically the gravity equation too, except in this case it's pushing the ball away from it's origin.


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Home About Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012