Problem with shooting up/down

This forum is currently in read-only mode.
  • Hi,

    i want my charackter to shoot up or down (45degree) when i press ctrl+up/down.

    This works great while he is facing the right side. But if i turn him he shoots behind him self... How can i check what hes facing and then tell him to shoot to this direction + 45 degrees up/down.

  • Assuming basic platform behavior, I'd do it something like so:

    + MouseKeyboard: On key Control pressed
    -> Charakter: Spawn object Ammo on layer 1 (image point 1)
        + MouseKeyboard: Key Down arrow is down
        -> Ammo: Rotate 45 degrees toward (Charakter.X, Charakter.Y + 100)
        -> Ammo: Set angle to Charakter.Angle + (Charakter.Angle = 0? 45 : -45)
        + System: Else
        + MouseKeyboard: Key Up arrow is down
        -> Ammo: Rotate 45 degrees toward (Charakter.X, Charakter.Y - 100)
        -> Ammo: Set angle to Charakter.Angle + (Charakter.Angle = 0? -45 : 45)[/code:fcer37nn]
    
    I used two different methods to set the angle there, but one is toggled off. The first just rotates the bullet 45 degrees toward a point above or below the character, and the second uses a [url=http://sourceforge.net/apps/mediawiki/construct/index.php?title=Expressions]conditional expression[/url] to set the angle either + or - 45 degrees from the character's angle.
    
    Here's the simple .cap file (v0.99.96) if the above is not clear: 
    
    [url=http://dl.dropbox.com/u/5868916/angledshot.cap]http://dl.dropbox.com/u/5868916/angledshot.cap[/url]
    
    .
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks a lot! Works great!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)