I would like to attempt to make a football juggling game in flash.

You simply click the ball and its "kicked up" and keep clicking it to keep it up.

See how high many times you can juggle the ball.

Maybe in a set amount of time.

So thats the plain, any ideas to help?

Thanks, Regards X

Dani AI

Generated

A compact roadmap and a tiny ActionScript 3 prototype to turn 's juggling idea into a working demo, while addressing 's note about physics and time constraints.

Keep the simulation minimal so it is easy to tune. Represent the ball with x,y and vx,vy. Use a fixed timestep (or delta time) and a constant gravity. Detect clicks with hitTestPoint (or bounding circle) and, on a valid hit, apply an upward impulse to vy (optionally add a small horizontal impulse based on click offset). Count a successful juggle when a click hits the ball while it is above the ground. For a fast prototype, use a fixed impulse rather than a full leg-animation model; add leg-path or timing-based power later.

A very small AS3 sketch (concept only):

var vy:Number = 0;
var gravity:Number = 1000; // px/s^2
var last:int = getTimer();
stage.addEventListener(Event.ENTER_FRAME, onFrame);

function onFrame(e:Event):void {
  var now:int = getTimer();
  var dt:Number = (now - last)/1000;
  last = now;
  vy += gravity*dt;
  ball.y += vy*dt;
  if (ball.y > groundY) { ball.y = groundY; vy = -vy*0.5; } // simple bounce
}

ball.addEventListener(MouseEvent.CLICK, function(e:MouseEvent):void {
  if (ball.hitTestPoint(e.stageX, e.stageY, true)) {
    vy = -700; // upward impulse
    score++;
  }
});

Polish suggestions: tune gravity/impulse, add touch support, visual feedback (squash/stretch, particles), timer and high-score persistence. Note: Flash Player is discontinued for browsers; for new web targets consider HTML5 Canvas/JS frameworks (CreateJS, Phaser) or porting the logic from this simple model.

Recommended Answers

All 3 Replies

Not realy, what you have to do is created an animation that will be based on physics.
Such as if there was very small path to travel from leg starting position to the point of contact with ball, ball will jump less. However if there is longer path to "travel" delivered kick will be stronger. If you cen get this for start that would be good, then you can try add some other conditions

Ya I have seen similar bouncing ball programs etc with physics applied but I thought there would be some tutorial on juggling :(

If there is no tute there will be alot of my time consumed which I cannot donate at this current time :(

Then I would recommend to not to start this project

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.