Elemental Devlog and stuff

is the code spread across multiple files? if so mobile doesn’t have a file explorer. If not then it’s just being stupid and not importing the code. Either way I’ll have to use a computer which I have limited time on, still could work on it though. I also have this tendency to forget easily. Also can’t work on it at school because of STUPID HOMEWORK. I will still try to solve it, assuming I remember.

Basically all you need to do is rename that “myImage0” image to something else and your issue will be fixed!

After looking at your code, there are a few tips I would like to mention!
The first thing to improve are your function and variable names. Please please PLEASE for the sake of anyone trying to read your code in the future, don’t use “a, b, c, d…” as variable names, unless they are in something like a simple For loop. Please use variables that describe themselves so that anyone reading your code can understand them. It is also useful for yourself! When you’re writing code, wouldn’t this:


be better than this:

I sure think so. It also lets you conveniently see what each variable means when you’re writing!

It works the same for functions too! That “doSomething” function with 8 single-letter inputs could be renamed to something like “generateSpriteImage” with inputs like “damage”, “defense”, etc. This would improve the readability of your code by so much, and you wouldn’t have to go all the way back to the function definition to figure out what each variable means later on!

The last thing I saw was that you used the sprite onOverlap function as if it had to be called in an update loop. You only need to call it once and it will run the function you input every time the sprites overlap after you call it once. Calling it multiple times creates more events that will run, meaning every time a sprite overlaps with another sprite that function will be run once for every time you have called the function, so basically you will be causing a ton of lag by calling it hundreds of times in an update loop.

1 Like