A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: AS2 Uphill issues

Threaded View

  1. #1
    Member
    Join Date
    Jan 2008
    Posts
    37

    [Solved] AS2 Uphill issues

    As the title says, I have an object moving downhil just fine but instead of moving uphill it will move through the hill.

    How do I make it move along the uphill slope?

    Code:
    onClipEvent (load) {
    	grav = 0;
    	spd = 1;
    }
    onClipEvent (enterFrame) {
    	if (_root.ground.hitTest(this._x, this._y, true)) {
    		grav = 0;
    		this._x += spd;
    	} else {
    		
    		grav += 0.3;
    		if (grav>5) {
    			grav = 5;
    		}
    	}
    	this._y += grav;
    }
    Edit: So it wont let me upload an attachment so ima try this
    -O-----O <--- there are 2 balls here, gravity makes them fall hitting the downslope.
    \........../ They slide down normally and move to the other side.
    \\____ // Where the Uphill for each begins. They will pass through the uphill like it was a flat surface. I hope this helps explain what i mean.
    If not please ask for more description.
    Last edited by Degraiver; 01-03-2010 at 08:00 PM. Reason: wont let me upload an attachment.

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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center