I've been making projects on scratch for a couple of weeks, but this is my first forum post. I've done Lua scripting before I started scratch (and thus have a very big headstart of the rest of my ICT class ). My first (uploaded) project I created was a glitchy platform game. I have also created Pong on scratch, but there is a few glitches I need to fix before I upload it.
Offline
Ty
Since then I have tried to make 2 more platformers, but 1 of them failed (the player lands on the floor, walks foward and falls through the floor), and the other 1 is very (for some unknown reason) very glitchy on 1 line of code. It was suppose to replicate Portal. I'd made the walking and jumping part of the script and it worked, but the portals themselves didn't work. Shooting was fine, but if you walk into the orange portal, it teleports you to the blue portal, as it should. But walking into the blue portal, teleports you to the center of the blue portal. I have no idea why.
Offline
Thanks.
I've been doing scripting in Lua for a while. I first saw scratch about a year ago, I downloaded it, and thought it was too simple and deleted it. I then downloaded it again a couple of weeks ago because we started using it in my ICT lessons. The rest of my class are learning about key presses, moving and changing costumes. I spend the lesson playing around, or helping other people.
Offline
I worked out why it wasn't working and I fixed it. It was because the code was setup like this:
change gntp by - 1
if key s pressed
if gntp = 0
if touching BluePortal
goto OrangePortal
set gntp to 30
end
if touching OrangePortal
goto BluePortal
set gntp to 30
end
end
end
The 'gntp' value means 'gone through portal'. It is a timer, so that you can't touch a portal and constantly get teleported through. You have to wait until it is 0 again. The reason this code didn't work is because you went through the blue portal, teleported to orange portal, and gntp set to 30. Then on the next if, it sees that you are touching the orange and teleports you back to blue, without checking for the gntp value.
Offline