Rabu, 22 Februari 2017

Move Sprite using Keyboard

Below is the script in Scratch for moving the Sprite to the right and to the left when the right arrow key and left arrow key are pressed.




In Unity, the same thing can be done with the following script.




Bellow is the detailed comparison between commands in Scratch and in Unity related to the above Script.

If then Command

In Scratch


In Unity

It means, if the condition between the ( and ) symbols is true then execute all commands that exist between the { and } symbols bellow the if command.

If then else Command

In Scratch


In Unity

It means if the condition between the ( and ) symbols is true then execute all commands that exist between { and } symbol bellow the if command, and if the condition is false then execute all commands that exist between { and } symbol bellow the else command.

Is Right Arrow Key Pressed?

In Scratch


In Unity


Is A Key Pressed?

In Scratch


In Unity


Tidak ada komentar:

Posting Komentar