0 Favourites

Tips & tricks compilation - Share your personal favorites!

  • I think a lot of us are really great at using C2, but I'm sure many people have interesting tricks and tips they use during coding that can make our lives easier. Let's share some of those tips!

      Set up a textbox with debug information, such as your character's speed, vectors, acceleration, etc. Put it on a 0,0 parallax UI layer so you can see it at all times. On player death, set up a textbox to appear saying "killed by X." This has helped me SO many times because it points you directly to the event on the event sheet that is related to the player death. Useful when there are traps in your levels. The "MoveTo" plugin lets you smoothly move any sprite over a distance or toward an object without changing its position every tick (like you would do without the plugin). Make your playable character's stats variables. For example, make his speed "PlayerMaxSpeed," then define this variable in the event sheet. If you ever need to change his speed or let the player upgrade, you won't have to go edit the event sheet line by line. Good for gravity, max speed, acceleration, etc. An easy pause screen event: On press (pause button) -> set time scale = 1-timescale. If it is 1, it'll go to 0 (paused). If it's 0 (paused) it'll go back to 1!
  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Easy 1 event toggler for when you want two different values that can be tested for.

    [Condition (for example when pressing a key)] -> Set variable (the variable that you want to toggle) to variable - variable*2.

    This will make it so that the event toggles the value between negative and positive.

  • Easy 1 event toggler for when you want two different values that can be tested for.

    [Condition (for example when pressing a key)] -> Set variable (the variable that you want to toggle) to variable - variable*2.

    This will make it so that the event toggles the value between negative and positive.

    I do it by using variable*-1 so it always toggles between 1 and -1 for instance (for True/False). There was a better way that used 0 and 1 but I always forget how to do it..

  • andreyin set variable to (variable+1)%2 ?

  • andreyin You're probably thinking of var = var - 1. Toggles between 0 and -1.

    A "trick" I like to pair with this is ternary operators / conditionals. Not the best example but they work like:

    Set bullet angle of motion to Player.Dir = 0 ? 0 : 180

    I suggest tracking down tulamide 's old tips and tricks thread. Had some pretty cool stuff in there. I suppose it was more of a "cool things you can do with math" thread though lol. Could definitely use more of those around here!

  • Well, it's little thing, but I like to add these as globals:

    TRUE = 1

    FALSE = 0

    NULL_ID = -1

    Sometimes I use 0 and 1 instead, but I like these for conditions like:

    PlayerActive = TRUE

    or, more usefully, calling a function, where I want to make it clear I'm passing a boolean val:

    Func SetFoobar(TRUE, 100, 200, 180)

  • Here's tulamide's post. It's a real gem.

  • Tokinsom

    I think that Aphrodite got it right, but I really suck at operators so I keep forgetting what do they do exactly.

    Also checking that old thread now, damn those are handy.

  • not sure if trick but definitely a performance booster.

    if you have pathfinding on your enemies and your obstacles move on screen -

    adding each 0.2s regenerate obstacle map (to family of objects) works pretty nifty and fast, instead of each tick. or per each enemy. on default settings 0.2s seems to have no effect of enemies hitting into sprites that are obstacles, tried 0.5s but then they do hit.

  • Do yourself a favour. Always name your layers. Dont just stick with the default name when you create a layer. It makes them far easier to refer to later in development.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
1,068 148,644
Reflextions's avatar
Reflextions
Unread hot topic
604 153,293
aniketraorane's avatar
aniketraorane
Unread hot topic
256 37,717
tutbarao's avatar
tutbarao