PDA

View Full Version : hittest in rpg game [renamed]



kudey
August 26th, 2006, 08:15 AM
hey i'm kudey. i need a actionscript for a wall in a rpg game:rambo:
so wat do i do first(note:i'm a bigginer)

Cobra Banshee
August 26th, 2006, 08:19 AM
What view are you using? Topdown? Isometric? perhaps Sideview? :P

I recommend searching for hitTest in the manual.

kudey
August 26th, 2006, 08:23 AM
i'm using top view
::kudey::

Cobra Banshee
August 26th, 2006, 08:25 AM
Alright, check for hitTest in the manual. I'm not 100% sure on how to make this, but hitTest should make it clearer to you. hitTest checks wheter a movieclip intersects with another movieclip, that's the collision.

kudey
August 26th, 2006, 09:58 AM
ok thanx for the hint:king:

scotty
August 26th, 2006, 06:34 PM
In future use more descriptive titles :cool:
moved to Game/AI Programming

scotty(-:

Holmesc
August 26th, 2006, 09:30 PM
Ok, if you want some script for a wall, in topview, it depends on which direction the wall faces, and which way the character is coming at it. Here's a diagram:
l
l <-wall
l
l
l :rambo: <character, moving towards wall
l

So, supposing the character's instance name is 'character', the code for the wall would be:

onClipEvent(enterFrame) {
if(_root.character.hitTest(this)) {
_root.character._x += 10;
}
}

This code assumes that 1.)The character's moving speed is less than 10, and 2) You only want the character to bounce 10 pixels or whatever. Change the x to y, the + to -, etc., to get him to bounce in the right direction. Mess with the 10 in
'_root.character._x += 10', and you can make your character bounce of more or less.
If you make a horizontal platform, and a character can bounce up... and you have the beginnings of a platformer! :P

Icehawk
August 26th, 2006, 09:35 PM
hey i'm kudey. i need a actionscript for a wall in a rpg game:rambo:
so wat do i do first(note:i'm a bigginer)

how come im the only one who gets made fun of for spelling he didnt :/

Templarian
August 27th, 2006, 03:01 AM
^Hes new.... you constantly do it and you've been here forever. I mean at least try to spelling things right or close to the word as possible.

nathan99
August 27th, 2006, 09:04 AM
http://www.n99creations.com/?pID=my_examples&col=Blue&arch=getBounds_as_walls&ver=Flash_games