Change direction of sprites?

0 favourites
  • 7 posts
From the Asset Store
Hand-animated Sprite Base for isometric game/animation development
  • Hello, I'm trying to make a game similar to SpaceInvader. I need all the aliens on the screen to move horizontally with the following logic: When one strikes the left edge of layout, all aliens change moving to the right, and when they strikes with the right edge, everyone started to move right.

    I've been trying to make them change their direction when they hit the edges but without changing their angles but I could not do it. The Alien type has the "bullet" and when i change your moving direction by modifying the angle, are flipped vertically. Thanks and sorry for bad english.

  • look at the bullet properties - set angle

    try setting that to "No"

    <img src="https://dl.dropboxusercontent.com/u/143636437/examples%20for%20web/Ashampoo_Snap_2014.02.14_12h32m44s_001.png" border="0" />

    Also look at the tutorial section - these will really help you get to know construct 2 quicker.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Change "angle set" to "no" and just the sprite changes direction but still fliping vertically. This is the logic I want to achieve:

    if (Alien.X > LayoutWidth) then (Move Alien to the right without flip the image vertically)

    if (Alien.X < 0) then (Move Alien to the left without flip the image vertically)

  • I got it:

    if (Alien.X> LayoutWidth) then (Invasor.Bullet.Speed ??* -1)

    But if i put it:

    if (Alien.X < 0) then (Invasor.Bullet.Speed ??* -1)

    The logic is cancelled. Any help?

    There is a event called "is outside layout" but with it i dont change the point of hit, for example: (Alien.X > LayoutWidth <font color=red>- 100</font>)

  • Solved: Put conditions in separate events.

  • sorry for the late reply.

    here is a very simple space invader left/right using bullets

  • Well, the way i see it, they aren't flipped, but just rotated, as you rotate the whole sprite, not just the speed vector.

    If you want to change the movement direction by 180 degrees, you could either:

    1.) set the speed to a negative value, for example

    "when sprite at necessary position / collides with the border -> sprite(bullet)speed = sprite(bullet)speed * (-1)"

    2.) rotate the sprite by 180 degrees and flip it vertically, you'd do this by setting the height to a negative value

    "when sprite at necessary position / collides with the border -> spriteheight = spriteheight * (-1)"

    horizontal flipping could be necessary, also.

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