How do I change a player sprite and behavior

0 favourites
  • 9 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • Hi there,

    So I have a sprite for the main player, i'll just describe it as a vehicle. I would like to be able to press a button and leave the vehicle behind and continue on foot, then go back to it later.

    What's the best way to achieve this?

  • I've managed to get something working but have one flaw with it. When I switch to the player outside of the vehicle and enable "scroll to" for it, it scrolls to it but not completely, it follows it a bit bit the character can run off screen.

  • okay I worked around it by removing the scroll to behaviours and calling scroll to object when they move instead.

  • Sorry for the late post took a moment to type everything up ::

    What you can do is have two objects PlayerCar and Player. For the PlayerCar object you can have a variable boolean instance called 'isDriving' if you player starts out outside of the car then you can set that to 'FALSE' by default. Then if you are using the 8 Direction for control give the car that behavior but again if the Player starts outside of the car set it to 'DISABLED'. Now on you player object create the 8 direction and Pin behavior.

    Now in the event sheet you can have when the player is overlapping the PlayerCar and hit whatever key it is to enter the car set the action to 1) Hide the player 2) Pin player to the car 3) set its 8 direction behavior to 'DISABLED' 4)set the car isDriving to 'True' 5)enable 8 Direction. So now where ever the car move to the Player object would follow invisibly.

    When they exit the car 1)set car to isDriving 'False' 2)Disable PlayerCar 8 Direction 3) set Player Visible 4)Unpin Player from PlayerCar 5)Set Player 8Direction to 'ENABLED'.

    Is another way of doing it. The isDriving boolean can be used in case certain keys match when the player is on foot. So the key would know which to do depending on if isDriving is set to true.

  • Try this work very good =D, just one thing for exit the vehicle i have add a new Event, when PlayerCar isDriven and on down key ... Then action as you say,

    Only one problem i can't use the same key with this method someone have an idea for use the same key ?

    If not thanks PhoenixNightly

  • What you do first is check if the carPlayer isDriven is set to true of false. Then execute the keys function you need.


    carPlayer isDriving=True then key do this

    else key do that.

  • I don't find the method for check if the boolean variable was true or false =s ...

  • Make an event for object playercar and it will say is 'boolean instance set' this will return true or false so create an else for this event in case its not set

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That's brilliant thanks, I done something very similar, it's surprising how easy it is to pick up construct2. I'm hoping to actually finish a game rather than losing interest half way through. It's going well at the moment!

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