
Character Movement in Avishkaar Game Builder: Loop or Stop at Screen Edges
One of the most common features in game development is controlling how a character behaves when it reaches the edge of the screen. Should it stop or should it wrap around to the other side? In this tutorial, you’ll learn two powerful methods to control sprite movement in your Avishkaar games:
- Looping the character across the screen edges
- Stopping the character at screen edges
Let’s dive in!
What You’ll Learn
By the end of this blog, you’ll understand:
- How to detect screen boundaries
- How to use gestures to control sprite movement
- How to loop a sprite from one edge to the opposite
- How to stop a sprite at screen boundaries
Setting Up the Game
Start by adding a simple emoji sprite as your character and a plain purple background to your game. In the Game Setup, configure:
- Background image with 100% opacity
- Sprite named "Character"
- Adjust the size and position as needed
This sprite will be the one we move using hand gestures.

Controlling Motion with Gestures
We use the distance between the thumb tip and index finger tip to control movement:
- If distance < 40 → move sprite right
- If distance > 100 → move sprite left
- If between 40 and 100 → sprite stays still

Method 1: Looping Sprite Across Screen
To allow your sprite to move off one edge and reappear from the opposite side:
- If X < 0, set X = 800 (wrap from left to right)
- If X > 800, set X = 0 (wrap from right to left)
- Y-position remains unchanged.
You can also apply the same concept for Y-axis to loop from top to bottom or vice versa.
Method 2: Stopping Sprite at Edges
If you want your character to stop when it touches the screen edge:
- Detect which edge it is touching: left, right, top, bottom
- Adjust the sprite’s position to prevent it from going further
Example:
If touching left edge → change X by +speed
If touching right edge → change X by -speed
This creates a “wall” at the screen boundaries so the sprite can’t go beyond.
Organizing with Functions
Use custom functions for both behaviors:
- loop_through_screen → for wrapping movement
- stop_at_edge → for stopping at screen bounds
Add the desired function into your game loop based on the behavior you want.

Final Result
- If your sprite exits the screen, it re-enters from the opposite side (loop).
- Or, it halts right at the screen’s edge and doesn’t go further (stop).
Both methods are useful for different game types. For example:
- Use looping for endless runners or space shooters
- Use stopping for platformers or puzzles
Wrap Up
These two simple techniques help you manage character motion cleanly. Whether you’re participating in a game challenge or making your own arcade game, these tricks are essential tools in your game-building journey.
If you have any doubts or want help debugging your version, feel free to leave a comment or question!
Stay creative, keep building. 🚀