Help me make Mario like game

Hmmm, I dont know,… Maybe try:


if (_root.goomba.hitTest(this.jump)) {
    if (maxjump<=10) {
        _root.goomba.gotoAndPlay("dead");
        _root.goomba.xspeed = 0;
        _root.counter.play();
        jumpSpeed = 10; 
    }
}

if that doesnt work, tell me.

Now, we need a key releasing code so that mario won’t run all of the time :). So, here is what we do. First we select mario (of course), then we type:


onClipEvent (keyUp) {
	 if (move) {
//again, we have "move" to determine if the movement is happenning//
		  if (Key.getCode() == Key.RIGHT) {
//now the getCode(), reffers back to the keyUp//
			  this.gotoAndStop("idle");
//this is what commands mario to go back to the standing position, or motionless frame//
	 }
	 if (Key.getCode() == Key.LEFT) {
		 this.gotoAndStop("idle");
	 }
	 if (Key.getCode() == Key.DOWN) {
		 this.gotoAndStop("idle");
		 xspeed = 5;
//remember, xspeed, if the "down" key is pressed, will drop to 0, so we need the "xspeed = 5" under this if statement, so as to allow movement once again after key release//
		}
	}
}

please reply if you have read this. More comin…

Aww… it wont work. Hey maybe if you tell how to make the goomba

i dont get it what u mean with those “idle” and stuff??

Well in your mario symbol make frames where he dies jumps runs is idle = normal
and name them as so. In frames properties there is frame label <FRAME label>in that you write it

so i should go into edit and make 1 frame of each? and do i need a specific name for them??

umm… yes.

joMan,

I have a quick question about your ground hitTest. Could you explain the reason for the !. if ([color=red]![/color]_root.ground.hitTest(this… I would really appreciate it. Good job on the thread bythe way!

what names do i need for the frames??

Oh, sorry that I wasnt here last night, I was at AVP, Alien Vs Preditor :). Ok now to answer your questions one by one. First, flashnewbie3, to make a goomba, we draw (or import) the goomba, then we create the sequences for the goomba, but the goombas animations are going to be put together a little different then the others (I have an attachment on the bottom that shows the goombas animation). Now, lets move on to the code, so select the action panel, and type:


onClipEvent (load) {
	 xspeed = 2;
	 started = true;
//AHA! there's started again! remember, the "started" controls the games action for the mcs moved on screen//
	 _root.counter.stop();
//As I have explained in the other thread, the "_root.counter.stop()" is for something later//
	 b = this.getBounds(this);
//now, this will be an important part of the collision detection farther on in the goombas action//
}

Alright, not to hard so far, right? Then let’s continue. So now we need his movement code, so we type:


onClipEvent (enterFrame) {
	 if (started) {
		 if (this._xscale == 100) {
			 _root.counter._x -= xspeed;
			 this._x -= xspeed;
		 }
		 if (this._xscale == -100) {
			 _root.counter._x += xspeed;
			 this._x += xspeed;
		 }
	 }
//continued...//

And yet again, started was there. Now we need some ground, and wall code, so lets type the following:


	 if (_root.ground.hitTest(_x+x+b.xmin+5, _y+y+b.ymin+5, true)) {
		 this._xscale = -100;
	 }
	 if (_root.ground.hitTest(_x+x+b.xmax-5, _y+y+b.ymin+5, true)) {
		 this._xscale = 100;
	 }
	 if (!_root.ground.hitTest(this._x, this._y+15, true) && !walking) {
		 fall += 1;
	 if (fall>5) {
		 fall = 5;
	 }
	 this._y += fall;
}
}

If you have any more questions, feel free to ask :). Here is the attachment I promised:

Well, You always have a standing frame, right? Then what we want to do is name it “idle”, because the word “idle” is smaller than the word “stand”, and it meens “not moving, stationary”.

here is an example:

Well, when I put the exclamation point before the code, it simply means that he is not performing whatever comes after that. Example:

 if (!_root.ground.hitTest(this........ //he is not touching the ground// 
 if (_root.ground.hitTest(this........  //he is touching the ground//

This is what I use for the falling code.

P.S.

Good job on the thread bythe way!
thanks :D.

Well, you name them whatever you want, but if it were me, I like to keep it simple, so I suggest these names:

  1. idle - for when mario is just standing.
  2. walk - for when mario is walking.
  3. duck - for when mario is ducking.
  4. jump - this one is used for both the jumping and the falling.
  5. die - for when mario is killed.

hope that helps ya :).

I wont be here at 10:00 through 1:00 cause I have fencing class…

ENGARDE!

i get this error all the time i have made mario a coin and the score thing

Error Scene=Scene 1, layer=Layer 1, frame=1:Line 10: Operator ‘=’ must be followed by an operand
}
Error Scene=Scene 1, layer=Layer 1, frame=1:Line 5: Statement block must be terminated by '}'
for (i=2; i<=numCoin; i++) {

Error Scene=Scene 1, layer=Layer 1, frame=1:Line 11: Syntax error.

Error Scene=Scene 1, layer=Layer 1, frame=1:Line 1: Statement block must be terminated by '}'
onClipEvent (load) {

Error Scene=Scene 1, layer=Layer 1, frame=1:Line 11: Syntax error.

Total ActionScript Errors: 5 Reported Errors: 5

Hmmm, send me your fla so I can take a look at the problem.

here it is

Umm could you modify that goomba script. I have leftbound (left wall) rightbound (right wall) and platforms (ground)

i dont get it…:-/ i suck at flash…could you send me yours?

That was 4 joMan but ill send my :slight_smile: But I have different scripts what joMan has