Remove Ads

Share on Facebook Share on Twitter

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Gaming Tutorial (how to make Walls)
#1
Here's the Second tutorial that follows on from the How to Walk Tutorial:

Step 1: read and do the tutorial from this link:
http://graphicsfans.createmybb.com/showt...php?tid=23

Step 2: when you've done that draw a wall (keep it simple to practise a little)

Step 3: Convert the drawn wall to a Movie clip

Step 4: add these actions to your character:
Code:
    while (_root.wall.hitTest(getBounds(_root).xMax, this._y, true)) {
        this._x--;
    }
    while (_root.wall.hitTest(getBounds(_root).xMin, this._y, true)) {
        this._x++;
    }
    while (_root.wall.hitTest(this._x, getBounds(_root).yMax, true)) {
        this._y--;
    }
    while (_root.wall.hitTest(this._x, getBounds(_root).yMin, true)) {
        this._y++;
    }

under
Code:
_rotation = 90;
}

and above
Code:
}

so the Complete code of the char will be:
Code:
onClipEvent(load){
speed = 8;
}
onClipEvent(enterFrame){
if (Key.isDown(Key.UP)){
this._y -= speed;
_rotation = 0;
}
if (Key.isDown(Key.DOWN)){
this._y += speed;
_rotation = 180;
}
if (Key.isDown(Key.LEFT)){
this._x -= speed;
_rotation = 270;
}
if (Key.isDown(Key.RIGHT)){
this._x += speed;
_rotation = 90;
}
while (_root.wall.hitTest(getBounds(_root).xMax, this._y, true)) {
    this._x--;
}
while (_root.wall.hitTest(getBounds(_root).xMin, this._y, true)) {
    this._x++;
}
while (_root.wall.hitTest(this._x, getBounds(_root).yMax, true)) {
    this._y--;
}
while (_root.wall.hitTest(this._x, getBounds(_root).yMin, true)) {
    this._y++;
}
}

Step 5: call the drawing of the wall "wall"
example:
[Image: wall7wz.jpg]

Be Sure you Selected the Movie Clip!

Step 6: Test your Game.

thats it

Have Fun!

//Rochy (and DarkstaR for the layout idea's of the tutorial)
Reply
#2
Awesome, you're the woman!
http://img412.imageshack.us/my.php?image=lul2im.swf
Reply
#3
^^ Good Job Hexo ^^

Soon i will post the movable item tutorial

this proofs that my tutorials are good and work ? :p
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Gaming Tutorial (how to walk) Ghettobird 12 2,108 06-23-2006, 07:17 PM
Last Post: Ghettobird
  Gaming Tutorial (How to Make Movable Items) Ghettobird 0 753 06-22-2006, 01:54 AM
Last Post: Ghettobird
  Basic tutorial [make a button] Ghettobird 0 496 06-20-2006, 05:00 AM
Last Post: Ghettobird

Forum Jump:


Users browsing this thread: 1 Guest(s)