User Tag List

Results 1 to 5 of 5

Thread: player shooting and moving

  1. #1
    No Products Registered

    Join Date
    Oct 2009
    Posts
    506
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    player shooting and moving

    im looking to have the player move eight directions and then shoot in the direction he is facing when pressing "spacebar"
    currently using this:

    x repeat while "space bar" is pressed
    -> player restore animation direction
    -> player set alt var a to 0

    alt var a=0
    repeat while "spacebar" is pressed
    player is facing direction "down"
    -> player change anim dir to "down"
    -> player set alt var a to 1
    -> player shoot "shot" at speed 100
    and so on for each direction

    im pretty sure this is !not! the way to do this.

    could you help?

    thanks

  2. #2
    Forum Moderator Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export Module
    DavidN's Avatar
    Join Date
    Jun 2006
    Location
    Boston, MA, USA
    Posts
    4,044
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: player shooting and moving

    You're right - when you find yourself about to clone a heap of events and very slightly modify them, there's often an easier way.

    You can use the player's direction as an input for where to shoot. On the "shoot object" dialog box, there's an option to "Shoot in specified direction" - select that, then select the "Use an expression" button (I think it looks like "1+1"). This takes you to the Expression Editor, where you can put in Dir("Player") - or use the "Retrieve data from an object" button to click through to the list of objects and select that expression from the Player object yourself. This will avoid you duplicating the event for each direction, so you can just have:

    alt var a=0
    repeat while "spacebar" is pressed
    -> player change anim dir to Dir("Player")
    -> player set alt var a to 1
    -> player shoot "shot" at speed 100 in direction Dir("Player")

    (I'm also not sure why you need to force your animations frames about here, but perhaps you have a reason for this!)

  3. #3
    No Products Registered

    Join Date
    Oct 2009
    Posts
    506
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: player shooting and moving

    you will have to forgive me i never programed in my life and it looked like an answer now i relize i will be asking for more help.
    in relation to force the animation i thought i had to make sure i was pointing in the correct direction for this to work as i said ive NEVER programed b4.

  4. #4
    Forum Moderator Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export Module
    DavidN's Avatar
    Join Date
    Jun 2006
    Location
    Boston, MA, USA
    Posts
    4,044
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: player shooting and moving

    You don't have to apologize, we've all been at your stage I just wasn't sure whether to leave in the animation direction changing action or take it out.

  5. #5
    No Products Registered

    Join Date
    Oct 2009
    Posts
    506
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: player shooting and moving

    hi i added x repeat while "spacebar" is pressed
    player -> change dir to dir "player"
    player -> set alt var a to 0
    as this improved the players movement
    added player collides with background
    player -> bounce
    but the player does not bounce hard to explane he stops dead their is no feedback from the impact.
    i am not using any custom movement for the player is it possible to achive this without custom movement?

    thanks for your time

Similar Threads

  1. Move player while he's on a moving platform?
    By BartekB in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 19th November 2013, 04:25 PM
  2. Player moving infront and behind objects
    By Hydra in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 17th January 2013, 05:03 PM
  3. Moving a player by increments?
    By Atherton in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 19th June 2009, 03:22 PM
  4. Moving an enemy towards the player
    By Jason in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 11th January 2008, 01:22 AM
  5. how to make object shooting at player?
    By piki in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 24th July 2007, 08:07 PM

Posting Permissions

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