Be a Supporter!

As: Rpg Movement

  • 1,179 Views
  • 4 Replies
New Topic Respond to this Topic
Hoeloe
Hoeloe
  • Member since: Apr. 29, 2004
  • Offline.
Forum Stats
Member
Level 37
Game Developer
As: Rpg Movement Apr. 20th, 2007 @ 04:09 PM Reply

AS MAIN PWNZ YOUR ARSE

Ok, this will probably have been done many times before, but i managed to develop my own script which is much simpler than most peoples, it will only allow 4 way movement though ¬-¬

start by making a movie clip which is a circle, give it the instance name: player

now, put this script on player:

//Script developed my Hoeloe
onClipEvent(load){
spd = 8;
//sets the player's speed
dir = 0;
//sets a variable called dir to 0
}
onClipEvent(enterFrame){
if(Key.isDown(Key.DOWN)){
this._y += spd;
//player moves down by spd
dir = 0;
//dir is 0;
}else if(Key.isDown(Key.LEFT)){
this._x -= spd;
//player moves left by spd
dir = 1;
//dir is 1
}else if(Key.isDown(Key.UP)){
this._y -= spd;
//player moves up by spd
dir = 2;
//dir is 2
}else if(Key.isDown(Key.RIGHT)){
this._x += spd;
//player moves right by spd
dir = 3;
//dir is 3
}
}

now for the walls. These MUST be rectangular or square or they wont work properly. Each wall must be a seperate rectange, and each should have this script:

//Script developed by Hoeloe
onClipEvent(enterFrame){
if(this.hitTest(_root.player)){
//if the wall is touching player
if(_root.player.dir == 0){
//if the player is facing down
_root.player._y += _root.player.spd
//player moves up by spd
}if(_root.player.dir == 1){
//if the player is facing left
_root.player._x += _root.player.spd
//player moves right by spd
}if(_root.player.dir == 2){
//if the player is facing up
_root.player._y -= _root.player.spd
//player moves down by spd
}if(_root.player.dir == 3){
//if the player is facing right
_root.player._x -= _root.player.spd
//player moves left by spd
}
}
}

Well, Thats all folks!

hope it's helpful!


Song of the Firefly is on Steam Greenlight and Facebook. Give them a look and support the project!
------------------------------

BBS Signature
GustTheASGuy
GustTheASGuy
  • Member since: Nov. 2, 2005
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to As: Rpg Movement Apr. 20th, 2007 @ 04:18 PM Reply

Pretty unreadable tutorial, the code itself is also very basic. If you want to help, help with something you can help with. As obvious as the sentance is, you can't help with AS, so don't.


BBS Signature
Blommestein
Blommestein
  • Member since: Nov. 7, 2006
  • Offline.
Forum Stats
Member
Level 06
Blank Slate
Response to As: Rpg Movement Apr. 20th, 2007 @ 04:21 PM Reply

Yeah whats the point of posting an inefficient version that has gay limitations (eg rectangular walls) when others are more efficient and do not have the limitations?

Hoeloe
Hoeloe
  • Member since: Apr. 29, 2004
  • Offline.
Forum Stats
Member
Level 37
Game Developer
Response to As: Rpg Movement Apr. 20th, 2007 @ 04:25 PM Reply

er.... i havn't seen a tutorial on AS: main that allows curved walls....

and any walls they do have are made by using 4 movieclips per wall!!!


Song of the Firefly is on Steam Greenlight and Facebook. Give them a look and support the project!
------------------------------

BBS Signature
Madferit
Madferit
  • Member since: Jul. 29, 2005
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to As: Rpg Movement Jun. 9th, 2007 @ 11:20 PM Reply

At 4/20/07 04:25 PM, Hoeloe wrote: er.... i havn't seen a tutorial on AS: main that allows curved walls....

and any walls they do have are made by using 4 movieclips per wall!!!

Anyone that hasn't heard of a shapeflag shouldn't be writing tutorials.