You might have seen if statements with some confusing symbols: &&, || or !. These are called the logical operators, and are used to create more complicated logic within an if statement. They are: && – the Logical AND operator || – the Locical OR operator ! – the Logical NOT operator Quick Examples But what do they do? I will give some quick examples. if…
This shows you how to check if any key key is being pressed on the keyboard and NOT the mouse in the correct way. There are some incorrect methods shown on the internet elsewhere.
This tutorial teaches you how to keep game objects from being destroyed when loading a new Unity scene. It will preserve them between multiple scenes.
This tutorial teaches how to import 2D pixel art graphics so they are nice and crisp, and then how to chop up your sprite sheets.
This tutorial shows you an easy, secure way to save and load your games data, converting it to binary (machine code), to make it hard for players to modify your data.
If you’ve ever wanted to write a script that could make your sprite flash a different colour or turn them transparent in Unity, there’s an easy way. The following code is C#. Sprite Renderer You’re sprite is contained in a component called the Sprite Renderer. Now if you click on “Color”, you can manually change…
This post is part of a series in learning how to make games with PuzzleScript. If you haven’t read my previous tutorials, I recommend you do so here, as that is assumed knowledge for this post. The Action Command By now we know how to walk around, push blocks and pull blocks, but what if we…
Sometimes you might want to check what’s next to an object. You might want to check if a duck is sneaking up behind you, or you might want to create blocks that can only be pushed horizontally, but not vertically. We can do this without too much difficulty.
For some reason you might want to create custom movement in your game. Ducks that can only walk left, crates that can only be pushed horizontally, that sort of thing. There’s a very simple way to do that, and I will show you how.
There might be times when you want to check for something only in a certain direction. You might, for example, want to create blocks that can only be pushed horizontally. Or you might want to create a duck that can only walk left. Whatever your reasons, you specify things to occur only in specific directions.