[I solved it] Changing velocity on actor issue

KIIVIINKIIVIIN Member Posts: 159
edited January 2016 in Help Wanted

Hello,

Im making a test game to learn gamesalad and got into some issue.
I got a character running with standard keys. I managed to make the character image face the way he runs with bolean attributes.

If FaceRight is true then spawn actor Right..
Destroy if false.
If FaceLeft is true then spawn actor Left
Destroy if false.

Pritty simple and works great.

Now I got the issue that when I shoot towards a monster the actor follow the characters attributes.
The weapon he shoots goes --> and when I turn the actor turns. That is because the true/false statement.

Im trying to find a way to make it go the way it shots and not follow the attribute of the characters facing way.
I managed to make it with 2 different actors as weapon but I dont want that. I want it more simple so I dont need to spawn 2 actors. Is it possible?

thanks in advance.

Comments

  • SocksSocks London, UK.Member Posts: 12,822

    @ervin.veisz said:
    I want it more simple so I dont need to spawn 2 actors. Is it possible?

    You can flip the image that is applied to the actor using . . .

    Graphics
    --Flip Horizontally

  • KIIVIINKIIVIIN Member Posts: 159

    @Socks said:

    @ervin.veisz said:
    I want it more simple so I dont need to spawn 2 actors. Is it possible?

    You can flip the image that is applied to the actor using . . .

    Graphics
    --Flip Horizontally

    What do you mean?
    Sorry for being so stupid haha

  • SocksSocks London, UK.Member Posts: 12,822

    @ervin.veisz said:

    @Socks said:

    @ervin.veisz said:
    I want it more simple so I dont need to spawn 2 actors. Is it possible?

    You can flip the image that is applied to the actor using . . .

    Graphics
    --Flip Horizontally

    What do you mean?
    Sorry for being so stupid haha

    I thought it perhaps might be useful for these kinds of situations for you to know that you can flip the image that is applied to your actor.

    By changing the Flip Horizontally attribute to true / false you can flip your actor's image horizontally.

  • KIIVIINKIIVIIN Member Posts: 159

    @Socks said:

    @ervin.veisz said:

    @Socks said:

    @ervin.veisz said:
    I want it more simple so I dont need to spawn 2 actors. Is it possible?

    You can flip the image that is applied to the actor using . . .

    Graphics
    --Flip Horizontally

    What do you mean?
    Sorry for being so stupid haha

    I thought it perhaps might be useful for these kinds of situations for you to know that you can flip the image that is applied to your actor.

    By changing the Flip Horizontally attribute to true / false you can flip your actor's image horizontally.

    Omfg...
    Thank you man.. Ive been doing attributes for that part.. !@#$% u saved me a lot of coding DAMN!

    Oh god I feel stupid -_-!

    But still how can I make the actor "weapon" that is flying away from the player to fly the way he turns?

    If i face right I want the actor to move right.
    Flip grafic is not the thing I ment but you still saved me on that one lol

  • KIIVIINKIIVIIN Member Posts: 159

    And one more question, Is there a way to make "tiled" on actors?
    Lets say I have a 50x50 tile I want to have but I dont want it to strech when actor is streched.

    Is that possible?

  • SocksSocks London, UK.Member Posts: 12,822

    @ervin.veisz said:
    And one more question, Is there a way to make "tiled" on actors?
    Lets say I have a 50x50 tile I want to have but I dont want it to strech when actor is streched.

    Is that possible?

    Yes, look under the Graphics attributes of the actor.

  • SocksSocks London, UK.Member Posts: 12,822
    edited January 2016

    @ervin.veisz said:
    But still how can I make the actor "weapon" that is flying away from the player to fly the way he turns?

    You've not given any details about the code that moves the weapon actor so any attempt to fix your issue would only ever be a guess as there are hundreds of different ways you might have this set up.

    But essentially all you have to do is change the direction the weapon is moving towards (I'm guessing you are using one of the Move behaviours), if it moves towards 0° when facing right, it then needs to move towards 180° when facing left.

    If you had a game attribute (let's call it 'X') which changed from 0 to 1, depending on which way you were facing, you could - for example - set the direction in a Move behaviour (for the weapon actor) to X*180.

  • KIIVIINKIIVIIN Member Posts: 159
    edited January 2016

    @Socks said:

    @ervin.veisz said:
    But still how can I make the actor "weapon" that is flying away from the player to fly the way he turns?

    You've not given any details about the code that moves the weapon actor so any attempt to fix your issue would only ever be a guess as there are hundreds of different ways you might have this set up.

    But essentially all you have to do is change the direction the weapon is moving towards (I'm guessing you are using one of the Move behaviours), if it moves towards 0° when facing right, it then needs to move towards 180° when facing left.

    If you had a game attribute (let's call it 'X') which changed from 0 to 1, depending on which way you were facing, you could - for example - set the direction in a Move behaviour (for the weapon actor) to X*180.

    I already did that but as soon as I turn the character away from the "actor" it spawns as weapon the actor (weapon) turns way Im facing. I want it to continue moving the way its shot.

    By the way, I added the strech thing so its tiled but when I put the actor on my screen its shown only in the editor screen. Playing the game its transparent. Why is that?

  • SocksSocks London, UK.Member Posts: 12,822
    edited January 2016

    //

  • KIIVIINKIIVIIN Member Posts: 159

    @Socks said:

    @ervin.veisz said:
    I already did that but as soon as I turn the character away from the "actor" it spawns as weapon the actor (weapon) turns way Im facing.

    I don't understand what that means, and you've still not given any details about the code that you are usng. Saying 'I turn the character' is less useful (when it comes to resolving a code issue) than saying how you turn the character, using what method, using which behaviours, triggered under what conditions (and so on).

    Okey one more time then. Sorry for my bad english :smile:
    Well, At the moment Im using a touch to spawn the actor "weapon" in front of my character.

    On the actor weapon I use "move direction 0" at the moment and the weapon moves ->>.
    But when I tried to use logic as attribute "if x is true then move >>>" If false then move <<.

    But the issue was that when I made my character face left the weapen i spawned turned and went left instead of right were i shot it. because the logic is false when he turned.

    So simple explaned : When I shot the weapon to so it travel right and make the char face left the weapon instent turned back towards me and traveled left etc.

    Btw, do you know why I cannot see my actors with the tile thing?
    I set the grafic to tile and placed it on the screen. In develop mode I can see it but ingame its transparent. I cannot find why.

Sign In or Register to comment.