If vs elif

I understand the point of the if vs elif statements, but would it make sense to group these by axis?

e.g.

image

2 Likes

for sure, looks like a good way of only having one of the axis movements running at any one time :+1:

i think using all single IF statements in the course, apart from being a gentle introduction to the Input system it would allow for counteracting forces to be applied if both left and right were pressed at same time.

IMO, using if/elif for an axis would give priority to the input you put in the if statement (i.e. the elif gets ignored), and in a game like this it almost feels more natural that pressing both left and right simultaneously cancels out the movement for that axis (which is the effect of all if statements).

This is definitely a good point, though. Some games may work more intuitively in the way you suggest.

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms