A Flash Developer Resource Site

Page 2 of 2 FirstFirst 12
Results 21 to 32 of 32

Thread: OnClick image apperance

  1. #21
    madskool.wordpress.com brutfood's Avatar
    Join Date
    Apr 2002
    Posts
    469

    Try the old-fashioned way

    Looks ok to me - but try the old fashioned (Flash 4) way:-

    setProperty("bulletHole"+name,_x ,_xmouse);
    setProperty("bulletHole"+name,_y ,_ymouse);

    Daniel

  2. #22
    I'll try it tommorow!

  3. #23
    That comes up with a synax(sp?) error!

  4. #24
    madskool.wordpress.com brutfood's Avatar
    Join Date
    Apr 2002
    Posts
    469

    Well I got it working

    Really?

    I got it working. I did it a little differently - we all have our individual styles of actionScript afterall.

    Create a new, empty, movie clip.

    Drag it onto the stage.

    Select it, so the top of the Actions Window says something like Actions Movie Clip (you are inserting a Movie Clip action, not a frame action)

    Put this in...

    onClipEvent (mouseDown) {
    attachMovie("bulletHole", ++name, name);
    setProperty (name, _x, _xmouse);
    setProperty (name, _y, _ymouse)
    }

  5. #25
    Junior Member
    Join Date
    Apr 2002
    Posts
    5
    pay attention to your mc's center

  6. #26

    :D 1/2 :(

    Some good news and some bad news:
    Good news: I got it to work!!! Yay!!! Thanks everyone for helping out!
    Bad news: When you shoot around 8 times in the top left corner, ywhen you shoot, nothing appereas, also, imade a rocket lancher, and that leaves a hole in the middle of the scorch mark, left behind from the rockets!
    S could you help me out with that one?
    ~~~
    Misc.: How can, when you hold down the mouse button, mutiable bullets come out? I've got a sound wave and bullet/scroch marks/holes, for every weapon, but just need the code to get it all to work!
    So could anyone help me out?
    Thank in advance!
    ASH...

  7. #27

  8. #28
    BuMp!

  9. #29
    madskool.wordpress.com brutfood's Avatar
    Join Date
    Apr 2002
    Posts
    469
    G'day mate,

    This simple problem just refuses to die doesn't it - I have days like that sometimes Sometimes months!

    Only 8 bullets - well, that's 2 more than they have in the old westerns! I need to know more about how you did this. what the actionscript looks like, and whether you are re-using something like your 'name' variable.

    Machine gun fire? - well, remember that empty movie symbol I asked you to create? Now put some actionscript inside it:-

    Frame 1: stop()
    Frame 2: attachMovie("Bullet Hole",++name,name);
    setProperty(name,_x,_xmouse);
    setProperty(name,_y,_ymouse)

    Frame n: gotoAndPlay(2)

    n is a small integer - depending on your rate of fire.

    Now go back, and replace the movie clip action of this symbol by:-

    onClipEvent(mouseDown) {
    gotoAndPlay(2)
    }

    onClipEvent(mouseUp) {
    stop()
    }

    ...and you have rapid fire.

    To change weapons, well your movie clip now needs an instance name. Call it 'control'. (also position it at (0,0) on the stage - just in case you need to access its (x,y) coordinates from _root - and detect if you've hit a target).

    To change weopons, use statements like:-

    control.weapon= "bulettHole";

    where the name in quotes corresponds to the export name of a library symbol. Create one for each weapon - and make then generate their own sounds (sound in timeline). Don't forget to put a stop() in the last keyframe to stop them looping.

    of course, modify the 'control' actionscript to:-

    attachMovie(weapon,++name,name);

    The rest, as they say, is an exercise for the reader.

    Daniel

    (It's been many years since I wrote a game - in fact the last time I did it - I think was on my ZX81 in the far distant past)



  10. #30
    Hey, can i send you the game over an email?
    Thanks!

  11. #31
    madskool.wordpress.com brutfood's Avatar
    Join Date
    Apr 2002
    Posts
    469
    Sure,

    brutfood@mail.dodo.net.au

  12. #32
    thanks mate!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center