Crashing, what did I do?
-
I feel like I've had this problem before and it was fixed by having the c = controls(0) line before the loop as well. But it's a bit of a stab in the dark (my main method of coding, hahah!). Might be worth trying, but if it doesn't work I'm sure someone else will post the answer soon
-
I've not touched sprites myself yet, but it doesn't look like you're doing anything wrong. I've read some posts about memory leaks in Fuze that looked related to the
+=
and-=
operators (and then using the same variable again in the next line).This might lead nowhere (I've not run the code myself), but could you try changing the -= and += operators respectively to
helib.x = helib.x - 8
,helib.x = helib.x + 8
,helib.y = helib.y - 8
,helib.y = helib.y + 8
. Just a wild idea, that might omit triggering a memory leak -
Thanks @PB____ just changed it, lets see how it goes.
Edit: Sadly it just crashed again with the stack overflow error. was worth a try though!
I'm cutting out various things to try and find out exactly which bit is causing it. first I commented out the setspritescale commands and it still crashed, then I commented out all the lines where I set the position of the bomb sprite and it still crashed.now I've commented out where I load and display my map (tileset). will see how it goes.
Edit2: I just tried commenting out all the movement if statements ..still crashed
commented out the map ..still crashed
commented out the bg graphic ..still crashed. -
I thought I was confused before but I'm 10x more confused now.
I tried commenting out everything in that simple listing last night and no matter what I removed it still crashed.This morning I run it as-is and that was 27 mins ago.. it's still working. So I'm utterly baffled as to what's going on.
-
@SteveZX81 Excellent. This is all intended, we just want to watch people struggle. evil laugh
No but this is a confusing one for sure. I'm sorry you're having that experience with the program. Out of interest, referencing @Kat 's previous comment, is your
c
variable global? This has certainly sorted the problem out for me before.Sometimes if a crash is happening, commenting out lines can only get you so far. I remember once during testing before release I had a huge program which crashed, I commented out literally every single line of code and it still crashed, haha. We fixed it, of course, but I'm saying that there is scope for things not to make sense on the surface.
-
Thanks Dave and yes, right at the top, before the main loop I have c = controls(0) (which I believe makes it global?)
-
@SteveZX81 I see, well that rules that one out! Apologies Steve.
-
You have nothing to apologise for, not your fault.
-
Sorry, the dump question, but did I understand this correctly? how does controls() read the controller input during every main loop iteration, when its outside of it? Or do just put a c=[] outside of the main loop?
-
it doesn't. (well, it didn't when I tried it)
-
Ahh.You are right @SteveZX81 I understood @Kat wrong: "c = controls(0) line before the loop as well" This is the trick, this means it does not create a new instance every loop. It just re-uses the existing variable. nice! I have to try this.
-
Mmm I just tried this putting c =controls(0) at the top of pogo Jo as I have called that function repeatedly throughout my program. It only got to the second control input and completely locked up had to turn switch off and I've had no issues at all with using c=controls(0) whenever I've needed to.