Pages: 1
Topic closed
I am currently making 2 games, and in both of them there is a huge glitch: you can walk through the walls.
Could someone please put up a script in scratchblocks?
Offline
OK, here is a script that should work:
when gf clicked forever if <touching color [#000000]?> //change this color to the color of the walls point in direction ( (direction) - (180) ) repeat until <not <touching color [#000000]?> > //change to color of walls move (1) steps //you may need to make this faster end end endTell me if there is any problem with that script or it doesn't work so I can fix it.
Last edited by SOScratch (2012-04-20 17:47:55)
Offline
The script really depends on whether you're viewing the character from the top or if it is a platformer. If it is top-down, try looking at this project. If it is a platformer, the script can vary quite a bit depending on what exactly you want. Here is pretty decent platformer-base that I made that should help. It includes the ability to climb a slant, as well as jumping and walls.
Offline
when gf clicked forever if < color [#00FF00] is touching [#735D35] ? > //change brown to color of walls set [XVel v] to ( (0) - (XVel) ) end if < color [#FFFB00] is touching [#735D35] ? > //same here. set [XVel v] to < [abs v] of (XVel)> end endNote this is color-based. Green is right side of sprite and yellow is left.
Last edited by Yoshi789 (2012-04-20 18:35:11)
Offline
You may have to make the walls thicker, if you want too and it doesn't affect the rest of the game. You could also try making xvel smaller (dividing xvelby a greater number).
Offline
Topic closed
Pages: 1