dcsimg
A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: Gun movement. Very easy.

  1. #1
    -_-
    Join Date
    Oct 2005
    Location
    US
    Posts
    1,694

    Gun movement. Very easy.

    I am creating a game, in which there will be a gun at the bottom. It is contained by an MC with the instance name of gunmove. When the mouse moves right, I want the gun to move right, and when the mouse moves left, I want the gun to move left. Can anyone show me how to do this? I am a noob in the area of game development.

  2. #2
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,227
    Go to Knowledgebase thread:
    http://board.flashkit.com/board/showthread.php?t=518121
    Click on "A Simple Game in Stages" then post thank you note for Mike here:
    http://board.flashkit.com/board/showthread.php?t=692343

  3. #3
    -_-
    Join Date
    Oct 2005
    Location
    US
    Posts
    1,694
    Thanks for the link, but it isn't what
    I needed. I just need the mc to move side to side, and stay on the bottom of the screen.

    PS. I placed the code on the MC, but it created errors.

  4. #4
    Hype over content... Squize's Avatar
    Join Date
    Apr 2001
    Location
    Lost forever in a happy crowd...
    Posts
    5,928
    Loving this new thing of rating a problem in the thread title

    So I guess you just want the gun to move left and right, as opposed to rotating ?

    A very quick and dirty hack to get you in the right direction:
    Code:
    onClipEvent(load){
    	this.onEnterFrame=function(){
    		this._x=_root._xmouse;
    	}
    }
    ( I thought from memory Mike's code moved it left and right too ? ).

    Anyway drop that code on a mc and it should work. Things like making it stop at the edge of the screen and inertia etc. are pretty simple to add.

    Squize.

  5. #5
    Junior Member
    Join Date
    May 2006
    Posts
    10

    gunaim

    Seems a lot like the question from a few days ago.

    http://board.flashkit.com/board/showthread.php?t=692224

  6. #6
    -_-
    Join Date
    Oct 2005
    Location
    US
    Posts
    1,694
    Thanks a billion. It worked!!!!!!!!!!!

    PS. I don't know if you could tell me this, but I plan on exporting my game in a projector app. Do you know how to make the menubar go away? And make it fullscreen. Just thought to ask,

    - Aaron

  7. #7
    Hype over content... Squize's Avatar
    Join Date
    Apr 2001
    Location
    Lost forever in a happy crowd...
    Posts
    5,928
    I typed "fullscreen" into Flash help, and it threw up the fsCommand,

    fscommand("fullscreen", true);

    To be fair you could have done exactly the same thing mate.

    Squize.

  8. #8
    -_-
    Join Date
    Oct 2005
    Location
    US
    Posts
    1,694
    Sorry, I'm lazy.
    Thanks.

  9. #9
    Wait- what now? tidenburg's Avatar
    Join Date
    Dec 2005
    Posts
    1,472
    also adobemedia you could use the better way which makes it move to the mouses x position:
    Code:
    onClipEvent (enterFrame) {
    	xdif = _x - _root._xmouse
    	if(xdif > 0){
    		_x -= xdif/5
    	}
    	if(xdif < 0){
    		_x -= xdif/5
    	}
    }
    "I'd only told them the truth. Was that so selfish? Our integrity sells for so little, but it is all we really have. It is the very last inch of us, but within that inch, we are free."

  10. #10
    Hype over content... Squize's Avatar
    Join Date
    Apr 2001
    Location
    Lost forever in a happy crowd...
    Posts
    5,928
    lol, that's me put in my place.

    Squize.

  11. #11
    Feeling adventurous? T1ger's Avatar
    Join Date
    Mar 2004
    Posts
    850
    No offence, but I dont like lazy people...

    But lazyness can often be confused with unknowingness...

    Point is: learn to use flash-help, and alot of things get easier
    I don't have a photograph, but you can have my footprints. They're upstairs in my socks.

  12. #12
    M.D. mr_malee's Avatar
    Join Date
    Dec 2002
    Location
    Shelter
    Posts
    4,140
    yep, flashkit should be used for problems.
    lather yourself up with soap - soap arcade

  13. #13
    Senior Member webgeek's Avatar
    Join Date
    Sep 2000
    Posts
    1,356
    Thanks for the pimp tonypa!
    I thought from memory Mike's code moved it left and right too ?
    Yes, it does, stage 2 covers following the mouse left and right...

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