ScratchData LogoScratchData
Back to APrules's profile

Player Position Using Variables

APAPrules•Created November 23, 2015
Player Position Using Variables
0
1
21 views
View on Scratch

Instructions

Use the arrow keys to control Scratch Cat! Try to avoid the crab (just as a fun addition, not the goal of the game)

Description

Just a test of using variables to change the positions of the player. Also using variables to change the position of the enemy relative to the position of the player (distanceX = enemyX - playerX) and (distanceY = enemyY - playerY). Feel free to use any of the code for your games or feel free to remix and play with the code to understand it better! PS: If you want to check the distance of an sprite and another sprite, ALWAYS do thisSprite'sPosition - otherSprite'sPosition (not using the exact same variables), and not the other way around. I learned that the hard way and got my crab moving AWAY from the player, not TOWARDS the player!

Project Details

Project ID88804995
CreatedNovember 23, 2015
Last ModifiedNovember 23, 2015
SharedNovember 23, 2015
Visibilityvisible
CommentsAllowed