So here is my thought. I am middle school teacher. My students are starting equations and I want them to see how different equations create different patterns. Contra was great at this. You get a power up and then your gun that was shooting straight lines now shoots at angles (slope equation) (or it shoots a circle forward or a wave) whatever. The right equation and you can make any crazy path.
Here is what I have so far.
Game play is left to right so projectile moves horizontal across the screen
When A is pressed generate a projectile at Player Sprite
(Currently I can only set a velocity, I want just the XY coordinate)
Start a timer (I think I can do this by cycling a value but would like an actual timer) I
change the X based upon the timer value a loop and increase
Change the Y based upon the X in the equation
I kind of envision something like:
def on_a_pressed():
global projectile
projectile = sprites.create_projectile_AT_sprite(img(ββ"
ββ"), mySprite)
IF PROJX <= 160
SET PROJECTILE X TO PROJX
SET PROJECTILE Y TO PROJX*(a slope value)
PROJX + 1
ELSE
PROJX = 0
It feels like something that should be achievable but I just canβt figure it out. Thanks.
This is great. Thank you. I read your code and am reminded of how much more I have to learn. Why did you use an array? How did it make it easier? Could you do without an array?
I assumed that you wanted all sprites that are the same kind to move in the same way. To find all sprites that are of a certain kind, sprites.all_of_kind() returns an array. There might not be any sprites of a particular kind (in which case, the array will be empty), there may be just one sprite, or there may be more than one. An array can handle all of those scenarios.