How do I make a customizable sprite?

  • Hi guys!

    I'm making a driving game and i want to let the Player change the car color by clicking a button;

    I've done these things below but when i click the button nothing happens:

    The game layout

    Frames

    Event i used

    Please help!

  • NOte: in the event sheet it should be:

    Set animation frame to 2 because we want to make it green!

  • I've tested the code in another game and it works, but in this one it doesn't work

    here's the full event sheet:

    First 6 codes belongs to the main menu

    Main menu

  • I would highly recommend to use "Tint" effect for purpose such as this.

  • Is your animation set to speed 0?

    Is there more than 1 sprite4?

    Are there any other events that could be conflicting?

    There should be no difference between the sprite having car-behaviour or not..

  • I would highly recommend to use "Tint" effect for purpose such as this.

    Using the "Tint" effect is probably far more cpu intensive then just changing a frame..

  • I see you are working with a lot of buttons, but in event 1, 2 and 3 you are not saying which button you mean when setting it enabled/disabled..

    You should make a reference to the button, so the program knows which one to perform the action on..

  • Is your animation set to speed 0?

    Is there more than 1 sprite4?

    Are there any other events that could be conflicting?

    There should be no difference between the sprite having car-behaviour or not..

    Yes, speed is 0

    There's only one sprite4

    I think it belongs to the buttons in the main menu, because when i tested the game without other buttons it worked correctly

  • I see you are working with a lot of buttons, but in event 1, 2 and 3 you are not saying which button you mean when setting it enabled/disabled..

    You should make a reference to the button, so the program knows which one to perform the action on..

    That's the start button, just named it button

  • Oh, you are using all different buttons..

    Scrap my previous remark..

    I don't see the car in your screenshot of the menu and I only see three buttons?

  • That's the game rule:

    if player entered "pass" in the text area-->enable 'start' button

    when player clicked 'start' button-->go to 'game' layout

    in the game layout:

    if player clicked 'green' button set frame to 2

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So this event sheet is also attached to the game layout?

  • LittleStain, maybe. But if you are creating good customisation - it will not be depends on the colours you painted.

    And it's very good time economy.

  • So this event sheet is also attached to the game layout?

    What?

    I don't understand

  • Every layout has to have an event sheet attached..

    The event sheet tells the layout what to do..

    https://www.scirra.com/manual/121/event-sheets

    Events which are exclusive for layout one can be kept on an event sheet attached to layout one..

    Events which are exclusive for layout two can be kept on an event sheet attached to layout two..

    If you click on the layout in the projects bar on the right, you'll see it's properties on the left..

    One of the properties is : Event sheet

    This is where you can tell C2 which event sheet it should use for this layout.

    (Normally C2 asks if it should attach a new event sheet when creating a new layout)

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