GMS 2 Can you make an "if and if" type of code (dnd)



Might sound a bit confusing, but can you make something like this.

If left not pressed, AND if right not pressed, AND if up not pres... e.t.c.

In DnD please!
Bit of a noob question.

(Edit: if you need more context don't be afraid to ask :D)
(Edit 2: never mind figured it out)
Last edited by a moderator:


🍋 *lemon noises*
GMC Elder
If you manage to figure out HOW you solve something, it's nice if you write about HOW you solved it as well so others with the same problem can learn from it.

Also, if you have a lot of "if not A, and not B, and not C" type things, you can get an easier time having the OPPOSITE logic: e.g, if not (left pressed or right pressed or up pressed..). So you can break out the "not" if you change every "and" into "or" and vice versa.

(Nerd trivia: this is called De Morgan's Law)



if not A and not B and not C and not D

is just multiple Test Variable actions all in a row.

Test not A
Test not B
Test not C
Test not D

But the method Yal mentioned is more streamlined and faster.