----------------------------------- hunter2 Sun May 21, 2017 5:48 pm Bizarre issue with View.Set command ----------------------------------- This is my first post on this forum, and I am somewhat of a newbie at Turing, and obviously with this forum, so please figure any mistakes I have made with either my code, or my post, and please point them to me so I can correct them. Anyway, I am trying to make a platformer game, where you have a ball (its a sprite) that you can move left or right or you can jump. However, I am having an issue with the View.Set command; namely, whenever I put in the following code, or some variation of it, I get an error that says "sprite was freed". I have been trying to make the window larger, by putting View.Set("graphics:800;800") Whenever I run it without that line, it looks fine, but I want the window to be bigger, so I need it, but whenever I run it with it there, the whole thing freezes, it says that the sprite was freed, and the window does not become larger. And just a note, the code as it is, is very messy, with lots of unnecessary stuff, as well as code that has been commented out momentarily. It's basically still a work in progress ----------------------------------- Insectoid Sun May 21, 2017 6:24 pm RE:Bizarre issue with View.Set command ----------------------------------- Your problem is almost certainly caused by your use of processes. I'm not sure exactly why this bug is happening, because it is a very unusual bug, and because processes make it nearly impossible to follow the execution of the program. If you comment out process X, the bug pops up in process Y. You should never, ever use processes except to play music. Just don't do it. This is why. Rewrite your code to completely replace your processes with procedures. If the bug persist, we'll continue from there. Even if we do fix the bug without replacing the processes, there will be tons of other bugs as well, as a direct result of using processes. Just don't use them. ----------------------------------- hunter2 Sun May 21, 2017 7:01 pm Re: Bizarre issue with View.Set command ----------------------------------- Thanks for the reply! I changed both X and Y over to procedures, as opposed to processes, and the code still functions the same. It is a very easy change, I just changed process X process Y over to procedure X procedure Y and then in the loop, instead of using fork, I just call the procedure by normal means. However, even after having done this, the bug persists, in the same way, with the same error message popping up, and the window still not changing size. Also just a question; why are processes so bad to use? What is wrong with them, and what sorts of bugs show up if you do? ----------------------------------- Insectoid Sun May 21, 2017 8:40 pm RE:Bizarre issue with View.Set command ----------------------------------- I think you may have found an actual bug in the language. Inside your ConstructPlatform function is a call to View.Set ("graphics"). Deleting this line makes everything work, even with View.Set ("graphics:600;800") in the main file. Here is a small program that reproduces the bug: [code] var pic := Pic.FileNew ("bal.bmp") var Ball := Sprite.New (pic) Sprite.Show (Ball) %this line executes fine View.Set ("graphics:800;700") Sprite.Show (Ball) %this line fails[/code] From experimenting, I've found that changing the dimensions of the run window after creating sprites causes the bug. In your example, you set the window size to 800x600. Later you call View.Set ("graphics") which resets the window to the default 640x480 and causes the bug. I can't find anything in the documentation to explain this, so I can only conclude that this is a bug in Turing itself. As far as processes go, well, they pause themselves to let other processes run. This causes code to be run out of order, and if both are modifying the same data, really weird stuff can happen. There is a longer explanation in the Turing Walkthrough. ----------------------------------- hunter2 Sun May 21, 2017 8:52 pm Re: Bizarre issue with View.Set command ----------------------------------- Yes! That fixed my problem! I've spent hours on this, and it's been quite frustrating not being able to figure it out. Thank you very much for taking your time to help me. It is very much appreciated. ----------------------------------- Insectoid Sun May 21, 2017 8:56 pm RE:Bizarre issue with View.Set command ----------------------------------- There's also a View.Set ("graphics") line in your newroll file. I suggest you remove that as well before it causes more issues.