Help with a game??
- Matchubox
-
Matchubox
- Member since: Feb. 16, 2005
- Offline.
-
- Forum Stats
- Member
- Level 19
- Blank Slate
I tried the lets make an RPG thread and it didnt have what i wanted...
I need an AS for a wall so that the character cant go through it.
would really appreciate the help.
- Zielak
-
Zielak
- Member since: Sep. 21, 2005
- Offline.
-
- Forum Stats
- Member
- Level 17
- Game Developer
- Devenger
-
Devenger
- Member since: Dec. 24, 2004
- Offline.
-
- Forum Stats
- Member
- Level 09
- Blank Slate
I'm back! on a temporary basis. No-one can remember who I am! but I don't really mind.
- Matchubox
-
Matchubox
- Member since: Feb. 16, 2005
- Offline.
-
- Forum Stats
- Member
- Level 19
- Blank Slate
thanx just gotta add an altered version of the code to my game...
cheers
- 4Doctodragon
-
4Doctodragon
- Member since: Feb. 5, 2005
- Offline.
-
- Send Private Message
- Browse All Posts (12,220)
- Block
-
- Forum Stats
- Member
- Level 31
- Blank Slate
wait... your calling him a noob, yet you havent realy done much in flash... *gasp* (suspence)
- Devenger
-
Devenger
- Member since: Dec. 24, 2004
- Offline.
-
- Forum Stats
- Member
- Level 09
- Blank Slate
Me? I just never get down to do any work, I suppose. I do know stuff, but I have something called school and homework, and spend the rest of the time browsing and stuff. :X
I'm back! on a temporary basis. No-one can remember who I am! but I don't really mind.
- Matchubox
-
Matchubox
- Member since: Feb. 16, 2005
- Offline.
-
- Forum Stats
- Member
- Level 19
- Blank Slate
that didnt exactly help because i only want to make it so the player cant go through a wall and i couldnt see that in the link...thanx anyway and if you could post some AS that would help i would be grateful.
i already know all the motion/hit test script. how to make stuff move etc...
i'm not really a newbie btw :)
- Devenger
-
Devenger
- Member since: Dec. 24, 2004
- Offline.
-
- Forum Stats
- Member
- Level 09
- Blank Slate
Well, it's all about adapting the hitTest code, isn't it?
I'm back! on a temporary basis. No-one can remember who I am! but I don't really mind.
- Matchubox
-
Matchubox
- Member since: Feb. 16, 2005
- Offline.
-
- Forum Stats
- Member
- Level 19
- Blank Slate
i think so i just cant get my head round it....
- Sam
-
Sam
- Member since: Oct. 1, 2005
- Offline.
-
- Forum Stats
- Moderator
- Level 19
- Programmer
At 10/8/05 12:28 PM, Matchubox wrote: that didnt exactly help because i only want to make it so the player cant go through a wall and i couldnt see that in the link...thanx anyway and if you could post some AS that would help i would be grateful.
Here ya go =D
...
onClipEvent (enterFrame) { if (this.hitTest(_root.INSTANCE NAME HERE)) { _x = _x+5; } }
Put this on the one that moves. Change the instance name to w/e you called the wall. That code was to stop them walking off the screen while walking left, to stop them walking off the screen while walking right use this code...
onClipEvent (enterFrame) { if (this.hitTest(_root.INSTANCE NAME HERE)) { _x = _x-5; } }
Tell me if you need any more help on this!
Thanks,
Sam
- Devenger
-
Devenger
- Member since: Dec. 24, 2004
- Offline.
-
- Forum Stats
- Member
- Level 09
- Blank Slate
Saza, with that code you will end up needing to add a lot of horrible, unoptimized code, because you need to hitTest against every single wall ...
... if you wan't that method, put the hitTesting on the walls.
I'm back! on a temporary basis. No-one can remember who I am! but I don't really mind.
- Sam
-
Sam
- Member since: Oct. 1, 2005
- Offline.
-
- Forum Stats
- Moderator
- Level 19
- Programmer
Hmm yeah, I guess that would be alot easier ^^;;
Still, im not that good at flash. xD
- Matchubox
-
Matchubox
- Member since: Feb. 16, 2005
- Offline.
-
- Forum Stats
- Member
- Level 19
- Blank Slate
sorry but this doesnt work, i've looked at other flash and you need to put code into the wall and i know how to make it so that you cant go off the screen and thats fine.
but yea thanx :S any more help would be most excellent
- Sam
-
Sam
- Member since: Oct. 1, 2005
- Offline.
-
- Forum Stats
- Moderator
- Level 19
- Programmer
btw they were only for the left and right walls, did you change the code, where it said INSTANCE NAME to the walls instance name?
- Matchubox
-
Matchubox
- Member since: Feb. 16, 2005
- Offline.
-
- Forum Stats
- Member
- Level 19
- Blank Slate
yea i did :s it just dint seem to do anything...
- Sam
-
Sam
- Member since: Oct. 1, 2005
- Offline.
-
- Forum Stats
- Moderator
- Level 19
- Programmer
- Paranoia
-
Paranoia
- Member since: Apr. 22, 2005
- Offline.
-
- Forum Stats
- Member
- Level 35
- Game Developer
At 10/8/05 12:26 PM, TheDeviousDuck wrote: Me? I just never get down to do any work, I suppose. I do know stuff, but I have something called school and homework, and spend the rest of the time browsing and stuff. :X
I find it's much more efficient to set yourself deadlines for your flashes!
I've yet to encounter a piece of school work which can't be delayed without consequence for at least a week
- Cojones893
-
Cojones893
- Member since: Mar. 9, 2003
- Offline.
-
- Forum Stats
- Member
- Level 22
- Blank Slate
Code for character
onClipEvent (load) {
lastx = 0;
lasty = 0;
}
onClipEvent (enterFrame) {
lastx = _x;
lasty = _y;
if (Key.isDown(Key.RIGHT)) {
_x += 2;
} else if (Key.isDown(Key.UP)) {
_y -= 2;
} else if (Key.isDow(Key.DOWN)) {
_y += 2;
} else if (Key.isDown(Key.LEFT)) {
_x -= 2;
}
// end if
}
CODE FOR WALL
onClipEvent(enterFrame){
if(hitTest(_root.CHARACTERNAME)){ //Change CHARACTERNAME to your players instance name
_root.playa._x=_root.playa.lastx
_root.playa._y=_root.playa.lasty
}
}
- Matchubox
-
Matchubox
- Member since: Feb. 16, 2005
- Offline.
-
- Forum Stats
- Member
- Level 19
- Blank Slate
sorry it didnt work :( this sucks cos nothing seems to do what i want would it have anything to do with flash 8 pro??? cos i had to change all my hitTests before so they worked on flash 8.....
- caseyo
-
caseyo
- Member since: May. 14, 2005
- Offline.
-
- Forum Stats
- Member
- Level 23
- Blank Slate
AS: Movement - Basic
AS: Collisions by Glaiel_Gamer
AS: Collision Detection by BleeBlap
I rest my case...
- Matchubox
-
Matchubox
- Member since: Feb. 16, 2005
- Offline.
-
- Forum Stats
- Member
- Level 19
- Blank Slate
At 10/8/05 01:13 PM, Matchubox wrote: sorry it didnt work :( this sucks cos nothing seems to do what i want would it have anything to do with flash 8 pro??? cos i had to change all my hitTests before so they worked on flash 8.....
well it sort of works thanx dude ill just addapt it to see if can make it work properly.
thanx a lot.. :)
- Cojones893
-
Cojones893
- Member since: Mar. 9, 2003
- Offline.
-
- Forum Stats
- Member
- Level 22
- Blank Slate
what doesn't work about it. You can't just say "it doesn't work" that could mean anything. Does he hit the wall? Does he walk through it? Does he walk through it then get stuck?

