PDA

View Full Version : Need Help



V Kyrie
April 15th, 2002, 08:44 AM
hiya, i posted up lookin for flash tutes to make my game in flash 4 but i guess it's virtually impossible to do so..... well, now i decided to do it in flash 5. here's my concept >

it's basically a game controllling a character to move in grid filled with objects like so >
1 0 1 0 1 0 1 0 1
0 0 0 0 0 0 0 0 0
1 0 1 0 1 0 1 0 1

where 0 (path) is passable n 1 (objects)not....

n i want d character to stand still when not moving and get to an animated frame of it moving when moved in whichever direction.

i guess dat's all i need for now. please help me with this as like i've said, i kinda new to actionscripting.

ur help would greatly be appreciated........ thanx

sinfiniti
April 15th, 2002, 10:44 AM
here's a sample file for checking for walls. you'll just have to animate the walking/movement from one square to the next.
jeremydecker.s5.com/walls_that_block.swf (http://jeremydecker.s5.com/walls_that_block.swf)
jeremydecker.s5.com/walls_that_block.fla (http://jeremydecker.s5.com/walls_that_block.fla)
:)
jeremy

V Kyrie
April 15th, 2002, 11:21 AM
hey man, thanx for the tip. at least now i have somethin to start on. i'm gonna give u credit in my game for sure. thanx again.......

btw, if u have any idea how i can do dat animation interval between moving n standing still, pls help. i can roughly say i noe about d animation stuff, but will it involve actionscriptin....?

sinfiniti
April 15th, 2002, 02:10 PM
just animate your guy/thing moving from one square to the next in all four directions, then have it do the appropriate animation when it figures out that there's no wall there.
this could be all actions or a combination of actions and animation.
:)
jeremy

V Kyrie
April 15th, 2002, 08:11 PM
hey again, i understand what u mean but could u show it to me step by step...? i'm crap at flash so hope u cld guide me....

sinfiniti
April 15th, 2002, 08:58 PM
example:
let's say your squares are 40x40 pixels.
animate a thing going from one square to another.
make sure that it moves exactly 40 pixels.
when it gets to the last frame of animation reset the 'thing' to the center of that movie clip.
now, the code works like this:
there is a loop with no animation, only the static 'thing' and code checking for the user to move the 'thing'.
when the user makes the 'thing' move the movie exits that loop, plays the animation, resets it's position to the new _x and _y coordinates, then goes back to the loop.
hope that helps.
:)
jeremy

V kyrie
April 15th, 2002, 10:47 PM
Cld u give me a simple example..... thanks

sinfiniti
April 16th, 2002, 12:20 AM
you owe me big...
;)
jeremydecker.s5.com/walls_that_block.swf (http://jeremydecker.s5.com/walls_that_block.swf)
jeremydecker.s5.com/walls_that_block.fla (http://jeremydecker.s5.com/walls_that_block.fla)

have a nice day,
:)
jeremy

V Kyrie
April 16th, 2002, 01:15 AM
heh, thankz man, i guess i'm really gonna owe u big time...... i haven't tried out the animation stuff but i was wonderin abt the tiled blocks u gave earlier.....

i see dat the walls are constructed by flash itself using the actionscript set....... i was wonderin, is it possible to use a symbol to act like the walls as well, like not letting my character pass thru?

if it is, yes u've guessed it, cld u guide me.....

V Kyrie
April 16th, 2002, 01:32 AM
sorry, i hope u have not started to hate me..... i'm juz someone in distress.....

i was gonna ask u whether it is possible to add a symbol above those scripted to appear. Like letting my character get covered half-way when its behind a symbol placed right on the wall area, keeping the grid walls n area intact.....

coz rite now, when in added a symbol, my character will move over instead of under it....

i'm tryin to explain it in simple terms but this is as close as i can get, hope its understandable......

thanx

V Kyrie
April 16th, 2002, 02:47 AM
Why doesn't my character animate smoothly when i press d direction key to move? when i press once, my character jerks to the next grid and then animates to the grid beside it.... it isn't as smooth as the example u gave me..... is there somethin wrong?

aslo, when i held a directional key, my character zooms across the stage, unlike urs where it smotthly n slowly moves from 1 grid to the next.....

sinfiniti
April 16th, 2002, 09:39 AM
look at the 'mcPlayerControls' movie clip. the _x or _y properties aren't changed until the animation is done. while the 'mcPlayerControls' movie is walking along it isn't accepting input from the keyboard.
what's probably happening in your movie is that your character is always checking for input from the keyboard, rather than being interrupted by the animation.
check it out and let me know if that helps.
:)
jeremy

V Kyrie
April 16th, 2002, 09:18 PM
i've looked thru it n yeah, there was a conflict in my script, thanx.... now it looks as smooth as silk... (well, kinda)......

anyway, i wanted to put hotspots in my maze where another scene will be played when my character gets in it........ so i tried using collision detection only in one spot (Danger Area A) among many which will have the same actions. it works......... BUT when i copied that area to another spot, the collision between my character n the duplicated area (Danger Area Copy) doesn't work...... any ideas..?

sinfiniti
April 16th, 2002, 11:22 PM
why not have the grid values be more than just 0 and 1?
you could place different values in the grid and depending on those values different things will happen. you would have to adjust the control code a little to accomodate the new types of ground.
also, if you want to raise a wall section above the player, just use swapDepth to raise the wall above the player piece. there's a swapDepth question here in this forum that has some good info....
pub40.ezboard.com/fkirupa...=629.topic (http://pub40.ezboard.com/fkirupafrm19.showMessage?topicID=629.topic)
:)
jeremy

V Kyrie
April 17th, 2002, 09:33 AM
hey , thankx for that swapDepth link...... to tell u d truth, i didn't understand a single word of it..... but i found another way n it works.... same too for that hotspot thingy.........

i'm working on d rest of it rite now, i'll keep u updated on any problems i'll encounter along the way......

once again, thanks so much, u've been a great help.....

V Kyrie
April 17th, 2002, 09:37 PM
it's me again...... i've run into a new problem recently.... it's like this>

when a key is pressed, an area of reach within the character limit will appear, consisting of a 3x3 box around, character in d middle..... now, when, let's say numpad 7 is pressed, an animation of the character attacking that direction (top left) will be played. then i want the character to return to it's static state......

but i have probs transiting between the "attack standby" mode and the attack animation..... when a key is pressed, it doesn't play..... why..?

sinfiniti
April 17th, 2002, 09:59 PM
there could be many reasons why this isn't happening.
check the key press code first - make sure that the input is working with a trace or something.
then check the conditional to be sure that the command is being read by the player.
then check the command that tells the clip to play.
then check the clip itself - label names, stops, plays, etc.
:)
jeremy

p.s. make sure you post that the game is done, i'd like to play it!

V Kyrie
April 18th, 2002, 02:50 AM
thankx for the checklist....

rite now, a new problem has popped up.... remember that "attack area" thingy? and the action that will take place when button pressed...? i got around that and it works..... BUT....

i did that appearance of the "attack area" as an animation in my characters EDIT timeline..... its on the same timeline as the animation of my character moving...

same too with the attack animation.....

now the problem is that i've used collision detection to detect the collisions between my character and my Hotspots... (remember that?)

now, because the "attack area" animation is within my character itself, even when my character is clear of the hotspots, when the "attack area" (u noe how big it is) is brought up, it overlaps the hotspots, thus running the Game Over screen which is the variable if my character collides with a hotspot......

understand...?

i hope u do coz i can't seem to find any other way...