The School

If(Jumping==true);
New Topic Add Reply Haunt!
EpicWin117
  • Posts: 14
  • Signup: 23/03/09
If(Jumping==true); Quote 2 years ago
Alright guys, I'm making a game (almost a week in) and I programmed my character to jump! But I also have problems with him touching the ground, by this I mean he jumps... great... falls.... awesome... but doesn't nessecarily touch the ground. Im thinking that this code that I have is effecting it, but my registration point is at the very bottom of my character.
Code:
_y-=16

When the char. hits the ground it sends it up 16 pixels. I've been editing this code for quite awhile now. Here is the full code from which I scripted.

(Please note, that I have been doing actionscripting for almost more then a year now, but it took me awhile to grasp the concept. My art skills are OK, but I am a programmer. I just need to collab with an artist, and I'll be happy )


Code:
onClipEvent (enterFrame) {

Velocity = 25;
if(gold>1000000);
speed = 10;
if(silver>1000000);
speed = 10;
if(copper>1000000);
speed = 10;
if (Key.isDown(Key.LEFT)) {
this._x -= Velocity;
gotoAndStop(2);
}
if (Key.isDown(Key.RIGHT)) {
this._x += Velocity;
gotoAndStop(1);
}
if (Key.isDown(Key.SPACE) && !jumping) {
termVelocity = 36;
jumping = true;
}
if (jumping == true) {
termVelocity -= 2;
if (vel_y<=-15) {
vel_y = -15;
}
this._y -= termVelocity;
}
if (_root.ground.hitTest(this._x, this._y+35, true)) {
vel_y = 0;
jumping = false;
}
}
onClipEvent (enterFrame) {
this._y += 16;
if (_root.ground.hitTest(this._x, this._y+1, true)) {
this._y -= 16;
}
}



If anyone sees a problem with my script right off the bat please do let me know.

Thanks in advance!
EpicWin117
  • Posts: 14
  • Signup: 23/03/09
W00T SW33T!!! Quote 2 years ago
Nevermind guys. I fixed the bug. In the collision detecting I changed the +35 to 0. I had the character hit the ground and bounce up 35 pixels.
Haha, what a dumbass I am!
BluMess
  • Name: Chris
  • Posts: 515
  • Signup: 15/12/08
Re: W00T SW33T!!! Quote 2 years ago
Nevermind guys. I fixed the bug. In the collision detecting I changed the +35 to 0. I had the character hit the ground and bounce up 35 pixels.
Haha, what a dumbass I am!


I'm glad I could help by doing nothing at all
Nice script you have
Loves everyone who posts in the forum
kaolin
  • Posts: 13
  • Signup: 24/12/08
Re: Re: W00T SW33T!!! Quote 2 years ago
Nevermind guys. I fixed the bug. In the collision detecting I changed the +35 to 0. I had the character hit the ground and bounce up 35 pixels.
Haha, what a dumbass I am!


I'm glad I could help by doing nothing at all


I'll second that
Flashtoo
  • Posts: 305
  • Signup: 03/07/09
Re: Re: Re: W00T SW33T!!! Quote 1 year ago
Nevermind guys. I fixed the bug. In the collision detecting I changed the +35 to 0. I had the character hit the ground and bounce up 35 pixels.
Haha, what a dumbass I am!


I'm glad I could help by doing nothing at all


I'll second that


I third(?) that.
Legal to drink!
BluMess
  • Name: Chris
  • Posts: 515
  • Signup: 15/12/08
Re: If(Jumping==true); Quote 1 year ago
Hmm, it will only work if there's a [ code ] AND a [ /code ].

Does it keep tripping up on speech marks or apostrophes?
Loves everyone who posts in the forum
Flashtoo
  • Posts: 305
  • Signup: 03/07/09
Re: If(Jumping==true); Quote 1 year ago
Hmm, it will only work if there's a [ code ] AND a [ /code ].

Does it keep tripping up on speech marks or apostrophes?


Wrong thread?
Legal to drink!
Woadraiders
  • Posts: 95
  • Signup: 03/07/09
Re: If(Jumping==true); Quote 1 year ago
We were trying to figure out a bug with posting code blocks, idk if he figured it out or not yet though.
Bestrafe mich.
Du darfst mein Bestrafer sein!
Der Herrgott nimmt.
Der Herrgott gibt.