Flyerman

Started by: AsSeenOnTV | Replies: 6 | Views: 2,195

AsSeenOnTV
2

Posts: 989
Joined: Dec 2008
Rep: 10

View Profile
Apr 27, 2010 9:40 PM #576886
I am speechless.

http://www.newgrounds.com/portal/view/534345
doc

Posts: 1,127
Joined: Jan 2009
Rep: 10

View Profile
Apr 27, 2010 10:03 PM #576905
hey thats not bad! A couple things though.
First of all your hittests are shaky. It looks like you have a bit of a code ordering problem. In your code for the head, it seems like you have the wall hittest before you have the arrow movements. So instead of having:

lookForWall(); //while(wall.hitTest(this._x+radius, this._y, true)){ etc.
move(); //if(Key.isDown(Key.LEFT)) etc.

You should have:

move();
lookForWall();

A really important thing to realize with flash is that it only draws everything out once per frame. It will read the code, then draw out where everything should be. So with mc "obj", if you had:

obj._x+=4;
obj._x+=2;
obj._x-=1;
obj._x+=6;

Flash would only draw out "obj" 11 pxls to the right (4+2-1+6), it wouldnt draw obj 4 pxls over, then 2, etc.

So in your code, You check for the wall to be there, thus moving it down, and THEN move it again if an arrow key is pressed.
Wow, i didnt mean to write all that. Does that make sense though? I have a few other things to say, but ill wait a little lol
Zed
2

Posts: 11,572
Joined: Feb 2009
Rep: 10

View Profile
Apr 27, 2010 10:03 PM #576906
Heh. Kinda fun. It wants a scoring system and a way to die though. Nice concept and the scripting more or less works :)
AsSeenOnTV
2

Posts: 989
Joined: Dec 2008
Rep: 10

View Profile
Apr 27, 2010 10:36 PM #576916
Thank you all. I didn't expect any positive feedback besides "WTFFFFFff"

What I'm using for the walls is
 onClipEvent (enterFrame) {
if (this.hitTest(_root.face)) {
_root.face._x -= 10;
}
}
(actionscript 2)
The wall is moving by 5 to the left. The face, if going forward, is moving by 5 to the right.
To keep the face from going inside of the wall, it moves the face 10 to the left. The face ends up moving 5 or 10 to the left depending if the face is moving right not. Works, right?
doc

Posts: 1,127
Joined: Jan 2009
Rep: 10

View Profile
Apr 27, 2010 11:13 PM #576933
Oh I see. Well I guess the only issue with that is if you hit the wall from the right, its gonna go through the wall. And that's possible with the left arrow things. But that doesnt get rid of the shakiness either way. Do you know what Im talking about?
AsSeenOnTV
2

Posts: 989
Joined: Dec 2008
Rep: 10

View Profile
Apr 27, 2010 11:34 PM #576937
I know what you mean.
I'll use examples.
Hit Test 1. When the ball is idle, it is pushed smoothly. When moving to the right, it is stopped when colliding with the wall.
Hit Test 2. When the ball is idle, it is NOT pushed smoothly. When moving to the right, it is pushed smoothly.
Such a simple problem. How could it be solved?
XaioShadow
2

Posts: 1,735
Joined: Feb 2012
Rep: 10

View Profile
Jul 9, 2012 5:10 PM #693893
lol fail i found a glitch :D
Image

when i do this i can fly forward with nothing blocking me :D

and on this one Hit Test 2.
i just went straight through the obstacles
Image