This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-05-30 04:12:43

meew0
Scratcher
Registered: 2010-02-22
Posts: 1000+

Can someone help me with this script

Hello,
I am making a game currently and there's something wrong with the collision detection script:

http://i.imgur.com/EGdtI.gif
(click for full size)

The script is supposed to stop the infection at the wall, at the border and at the player.
But when the player is supposed to stop the infection, the detection doesn't work.

When the player is not blocking the infection, everything works well. But when the player SHOULD be blocking it, the infection even goes through the wall!

~meew0


http://i.imgur.com/mJV3j.pnghttp://i.imgur.com/HwWAX.pnghttp://i.imgur.com/sZ7Ui.pnghttp://i.imgur.com/0y6yh.pnghttp://i.imgur.com/nOC4l.png

Offline

 

#2 2011-05-30 05:34:10

wpd
Scratcher
Registered: 2009-08-15
Posts: 4

Re: Can someone help me with this script

I don't see anything wrong with the scripts. You could download perfect platformer base and change around the costumes to make it like your game.

Offline

 

#3 2011-05-30 06:07:30

meew0
Scratcher
Registered: 2010-02-22
Posts: 1000+

Re: Can someone help me with this script

wpd wrote:

I don't see anything wrong with the scripts. You could download perfect platformer base and change around the costumes to make it like your game.

*cough* This game isn't a platformer *cough*


http://i.imgur.com/mJV3j.pnghttp://i.imgur.com/HwWAX.pnghttp://i.imgur.com/sZ7Ui.pnghttp://i.imgur.com/0y6yh.pnghttp://i.imgur.com/nOC4l.png

Offline

 

#4 2011-05-30 06:08:21

deerel
Scratcher
Registered: 2008-08-23
Posts: 89

Re: Can someone help me with this script

Well, the ifs are problematic because you test wall and border and simutaneously only x or only y of the player. This ends with ridiculous behaviour. You should have ifs that only test the border, than ifs that only test the walls, then if that only test a player (but then, both x and y).

Offline

 

#5 2011-05-30 06:10:08

meew0
Scratcher
Registered: 2010-02-22
Posts: 1000+

Re: Can someone help me with this script

deerel wrote:

Well, the ifs are problematic because you test wall and border and simutaneously only x or only y of the player. This ends with ridiculous behaviour. You should have ifs that only test the border, than ifs that only test the walls, then if that only test a player (but then, both x and y).

The weird thing is, that without the player detection, all works perfectly. So it can't be this.


http://i.imgur.com/mJV3j.pnghttp://i.imgur.com/HwWAX.pnghttp://i.imgur.com/sZ7Ui.pnghttp://i.imgur.com/0y6yh.pnghttp://i.imgur.com/nOC4l.png

Offline

 

#6 2011-05-30 06:13:12

deerel
Scratcher
Registered: 2008-08-23
Posts: 89

Re: Can someone help me with this script

If you refuse help, you can't be helped...
Or, in other words: deep sigh, read it over again, and try to understand it :-)

Offline

 

#7 2011-05-30 06:25:54

meew0
Scratcher
Registered: 2010-02-22
Posts: 1000+

Re: Can someone help me with this script

deerel wrote:

If you refuse help, you can't be helped...
Or, in other words: deep sigh, read it over again, and try to understand it :-)

I don't refuse help...


http://i.imgur.com/mJV3j.pnghttp://i.imgur.com/HwWAX.pnghttp://i.imgur.com/sZ7Ui.pnghttp://i.imgur.com/0y6yh.pnghttp://i.imgur.com/nOC4l.png

Offline

 

Board footer