Based on the article published last month, we will go one step further by adding a user movable sprite.
The green square represents our sprite and we will use the map Array() to check if it can be moved in the direction requested.
Pretty simple! The movie clip is attached from the library and placed on the stage. Then we setup the two
coordinate systems... why two? Because we use Array positions to know where we are and we also use pixel positions to physically move the sprite. So px and py represent our in-the-Array location.
The next piece of code is a function that is executed every frame and it simply checks which directionkey is pressed and it processes the request accordingly: