
print("Hello, World!") print(42) print(variable)
The print statement outputs text or values to the console, allowing the program to display information to the user. When called, it takes the given input, converts it into a string if necessary, and sends it to the console so it appears as visible output. This is useful for showing messages, results, or other important data during the program's execution.
set variable = "Hello, World!" variable = 42 variable++ variable--
A variable is a named storage location that holds a value which can be changed during the execution of a program. It allows the program to store data, update it, and reference it when needed. A variable is assigned a value using the assignment operator and can be updated by assigning a new value or by applying operations that modify its current value. Variables make it possible for a program to keep track of information, perform calculations, and manage changing data throughout its run.
while (variable < 10) print(variable) variable++ endloop while (true) setPos(scrotchDog, x, y) endloop
A while loop repeatedly runs a block of code as long as a given condition is true. A while true loop has a condition that is always true, causing the loop to run without stopping. This type of loop can be used to create a game loop, where the program continuously updates the game state, processes input, and renders the screen. By running these actions in a constant cycle, the game remains active and responsive, allowing it to keep running smoothly until a condition within the loop signals the end of the game.
if (variable < 10) print("Variable is less than 10") end if (keyPressed("space")) setPos(scrotchDog, x, y) end
An if statement checks whether a specific condition is true and runs a block of code only if that condition is met. This allows a program to make decisions and perform actions based on certain situations. When the condition is true, the code inside the if statement is executed; if the condition is false, that code is skipped. This makes if statements useful for controlling the flow of a program and responding to different inputs or states.
display("scrotchDog.png", width, height, xPos, yPos)
The display statement initializes an uploaded sprite and sets its starting position, height, and width. It allows you to load an image or graphic to be shown on the screen and define its size and location within the display area. By using the display statement, you can control where the sprite appears on the screen, as well as its dimensions, ensuring it is rendered correctly within the game or application environment.
setPos(scrotchDog, xPos, yPos)
The setPos statement changes the position of a displayed sprite on the screen. By specifying the sprite's name without quotations and its new x and y coordinates, you can move the sprite to a different location within the display area. This allows for dynamic positioning of sprites, enabling them to respond to user input or other events in the program. The setPos statement is essential for creating interactive and animated elements in a game or application.
setRotation(scrotchDog, angle)
The setRotation statement changes the angle at which a displayed sprite is rotated. By specifying the sprite's name without quotations and the desired angle in degrees, you can rotate the sprite to create dynamic visual effects. This allows for animations, such as spinning or tilting, enhancing the overall appearance of the game or application. The setRotation statement is useful for creating engaging and visually appealing elements that respond to user input or other events.
clone(scrotchDog, cloneName)
The clone statement creates a copy of an existing sprite, allowing you to generate multiple instances of the same object. By specifying the original sprite's name without quotations and providing a new name for the clone, you can create duplicates that can be manipulated independently. This is useful for creating multiple characters, enemies, or objects in a game without having to define each one separately. The clone statement enables efficient management of similar sprites while maintaining their individual properties and behaviors.
delete(scrotchDog)
The delete statement removes a displayed sprite from the screen. By specifying the sprite's name without quotations, you can eliminate it from the display area, effectively stopping its rendering and any associated behavior. This is useful for managing the visibility of sprites, such as removing enemies or objects when they are no longer needed. The delete statement helps keep the display area organized and ensures that only relevant sprites are shown at any given time.
keyPressed("a") while (true) if (keyPressed("a")) setPos(scrotchDog, x, y) x-- endloop
The keyPressed statement checks whether a specific key on the keyboard is currently being pressed. By providing the key's name in quotations, you can determine if that key is active at any given moment. This is useful for creating interactive controls in a game or application, allowing the program to respond to user input. The keyPressed statement can be used within loops or conditional statements to trigger actions based on the state of the specified key, enabling dynamic and responsive gameplay.
abs(variable) sqrt(variable) round(variable) floor(variable) ceil(variable) exp(variable) pow(variable, exponent)
The math functions provide a set of mathematical operations that can be performed on numeric values. These functions include absolute value (abs), square root (sqrt), rounding (round), flooring (floor), ceiling (ceil), exponentiation (exp), and power (pow). By using these functions, you can manipulate and calculate values in various ways, enabling complex mathematical operations within your program. This is useful for performing calculations, processing data, and creating dynamic behaviors based on numerical input.
sin(variable) cos(variable) tan(variable) log(variable)
The trigonometric functions provide a set of operations for working with angles and their relationships to the sides of triangles. These functions include sine (sin), cosine (cos), tangent (tan), and logarithm (log). By using these functions, you can perform calculations related to angles, distances, and other geometric properties. This is useful for creating animations, simulating physics, and implementing complex behaviors based on angular relationships within your program.
if (variable < 10 and variable > 5) print("Variable is between 5 and 10") end if (keyPressed("a") or keyPressed("b")) print("Either 'a' or 'b' is pressed") end if (variable == 10) print("Variable is equal to 10") end
The conditions allow you to evaluate multiple expressions and determine whether they are true or false. By using logical operators such as "and" and "or," you can combine conditions to create more complex evaluations. This enables you to check for multiple criteria simultaneously, allowing for more sophisticated decision-making within your program. The conditions are useful for controlling the flow of execution based on various states or inputs, making your program more dynamic and responsive.