Watch a video on how to convert the game you developed in pyleap to an executable file. So that you can share among your friends and let them play without installing python and pyleap.
Attributes: mouse.x = returns the x-coordinate of mouse position mouse.y = returns the y-coordinate of mouse position mouse.LEFT = returns True if the left mouse button is pressed mouse.RIGHT = returns True if the right mouse button is pressed Methods: on_move(function) – The function will be called when the mouse moves. on_press(function) – The function will be called when left mouse […]
Rotation: Sets the rotation angle. Default is 0 or 360 degrees. The anchor of rotation by default will be at the center of the sprite and the rotation happens in an anti-clockwise direction. Syntax: set_anchor(x, y): Sets an anchor point for the rotation of a sprite to x and y. (OR) Sets the center point […]
Transformation is all about changing the scale(changing the size): The default value is 1. We can scale from 0 to 1. 1. scale (scaling both x and y values) 2. scale_x (horizontal scale of the sprite) 3. scale_y (vertical scale of the sprite) Project: School Bus Source code: Output:
Image To insert an image we have to use the Sprite method. Syntax: url = file path or url of the Sprite (image format should be specified)x = x-coordinate of the center of the spritey = y-coordinate of the center of the sprite Text Syntax: src = Text contentx, y = position of the bottom […]
There are two drawing methods to draw shapes in pyleap: draw() – will draw complete graphic on the canvas. stroke() – will draw only the stroke line of the shape. Now, let’s look into drawing different types of shapes in pyleap: 1. Line x1 = x-coordinate of the start point of the liney1 = y-coordinate […]
The four handy window methods are explained with an example: 1. window.set_size() A default window size is width = 640 and height=480. But you can change as per your requirement. To change your window size use the command: 2. window.set_caption() By default, the window caption will be leap learner but you can change using the […]