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

#1 2010-08-13 16:59:07

steppenwulf
Scratcher
Registered: 2009-07-23
Posts: 1000+

Does anyone know of a way to do collision sensing without hitests?

I forgot who made a project on this, but I need to know how to get your character not to move through walls, without using hittests.


I'm graduating HS this April and going to college in the Fall.

Offline

 

#2 2010-08-13 17:16:19

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Does anyone know of a way to do collision sensing without hitests?

I can't think of any practical way... Why would you want to, anyway?


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#3 2010-08-13 22:17:25

MabonBaladevaKain
Scratcher
Registered: 2010-07-25
Posts: 80

Re: Does anyone know of a way to do collision sensing without hitests?

What do you mean by hittest?

Do you mean <if><touching[ sprite1 ]
or <if><touching color[ red ]

Those commands? .. or are you talking about something else? I'm kinda new to Scratch still so please excuse my ineptitude concerning the lingo. I don't mean to annoy or offend if this is one of those questions that bother advanced users, apology in advance just in case.  wink

Do you maybe mean without using variables Like this? ...
... <if><(  <{ Variable 1 }><=> 5)> <change y by( 5<else><change y by( -5

Offline

 

#4 2010-08-13 22:27:51

soupoftomato
Scratcher
Registered: 2009-07-18
Posts: 1000+

Re: Does anyone know of a way to do collision sensing without hitests?

MabonBaladevaKain wrote:

or are you talking about something else? I'm kinda new to Scratch still so please excuse my ineptitude concerning the lingo. I don't mean to annoy or offend if this is one of those questions that bother advanced users, apology in advance just in case.  wink

It was your rant about not insulting you that bothered me.  smile  Everyone is really nice here.  smile

Anyway, when you type blocks, make sure to put [blocks] before them and [/blocks] after or the rest of the post is bold.


I'm glad to think that the community will always be kind and helpful, the language will always be a fun and easy way to be introduced into programming, the motto will always be: Imagine, Program, Share - Nomolos

Offline

 

#5 2010-08-13 22:56:39

jackrulez
Scratcher
Registered: 2009-08-01
Posts: 1000+

Re: Does anyone know of a way to do collision sensing without hitests?

soupoftomato wrote:

MabonBaladevaKain wrote:

or are you talking about something else? I'm kinda new to Scratch still so please excuse my ineptitude concerning the lingo. I don't mean to annoy or offend if this is one of those questions that bother advanced users, apology in advance just in case.  wink

It was your rant about not insulting you that bothered me.  smile  Everyone is really nice here.  smile

Anyway, when you type blocks, make sure to put [blocks] before them and [/blocks] after or the rest of the post is bold.

I think you mean this. (The [blocks] and [/blocks] tags weren't showing up.)


Yawn, another boring text signature. I should really make something better.

Offline

 

#6 2010-08-13 23:07:44

steppenwulf
Scratcher
Registered: 2009-07-23
Posts: 1000+

Re: Does anyone know of a way to do collision sensing without hitests?

Harakou wrote:

I can't think of any practical way... Why would you want to, anyway?

Can't tell you  tongue


I'm graduating HS this April and going to college in the Fall.

Offline

 

#7 2010-08-14 02:59:19

MabonBaladevaKain
Scratcher
Registered: 2010-07-25
Posts: 80

Re: Does anyone know of a way to do collision sensing without hitests?

I'm probing Scratch a bit concerning collisions.
So keep an eye on my projects. It may appear there sooner than you think.
Or maybe never, depending on whether I can figure it out or if it's even possible.

I have an idea in mind how to without variables if that's what you mean.
The without using the touching thing might be a bit more difficult, but I have an idea for that too. I pretty much have an idea for everything. Sometimes the ideas work, sometimes they don't.

Offline

 

#8 2010-08-14 12:04:42

AtomicBawm3
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Does anyone know of a way to do collision sensing without hitests?

I've used a list technique, but that really only works on projects with square pieces.


http://i50.tinypic.com/j0yw0p.jpg

Offline

 

#9 2010-08-14 13:41:11

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Does anyone know of a way to do collision sensing without hitests?

steppenwulf wrote:

Harakou wrote:

I can't think of any practical way... Why would you want to, anyway?

Can't tell you  tongue

Can't really help you if you can't at least give us an idea of what you have in mind.  hmm  And like Atomicbawm3 said, you can use a sort of (distance to _) thing, but it only really works with objects that are round.


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i.imgur.com/OZn2RD3.png&amp;link2=http://i.imgur.com/duzaGTB.png&amp;link3=http://i.imgur.com/CrDGvvZ.png&amp;link4=http://i.imgur.com/POEpQyZ.png&amp;link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#10 2010-08-14 13:59:56

steppenwulf
Scratcher
Registered: 2009-07-23
Posts: 1000+

Re: Does anyone know of a way to do collision sensing without hitests?

Harakou wrote:

steppenwulf wrote:

Harakou wrote:

I can't think of any practical way... Why would you want to, anyway?

Can't tell you  tongue

Can't really help you if you can't at least give us an idea of what you have in mind.  hmm  And like Atomicbawm3 said, you can use a sort of (distance to _) thing, but it only really works with objects that are round.

Oh I gave up on what I was trying to do in the first place because there is no <I receive [ ]> block and I don't feel like working around it. I was trying to make a mini pac man game where pac man would stay inside a little game screen.


I'm graduating HS this April and going to college in the Fall.

Offline

 

#11 2010-08-14 14:27:30

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Does anyone know of a way to do collision sensing without hitests?

steppenwulf wrote:

Harakou wrote:

steppenwulf wrote:


Can't tell you  tongue

Can't really help you if you can't at least give us an idea of what you have in mind.  hmm  And like Atomicbawm3 said, you can use a sort of (distance to _) thing, but it only really works with objects that are round.

Oh I gave up on what I was trying to do in the first place because there is no <I receive [ ]> block and I don't feel like working around it. I was trying to make a mini pac man game where pac man would stay inside a little game screen.

Oh. So you didn't want pac man to actually hit the wall before he stopped? In that case, just make a sensor sprite that is larger than pac man, set its ghost effect to 100, and put the hit-tests on that!  big_smile


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i.imgur.com/OZn2RD3.png&amp;link2=http://i.imgur.com/duzaGTB.png&amp;link3=http://i.imgur.com/CrDGvvZ.png&amp;link4=http://i.imgur.com/POEpQyZ.png&amp;link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#12 2010-08-14 14:31:19

shadow_7283
Scratcher
Registered: 2007-11-07
Posts: 1000+

Re: Does anyone know of a way to do collision sensing without hitests?

RHY can do it.  big_smile

Offline

 

#13 2010-08-14 14:32:13

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Does anyone know of a way to do collision sensing without hitests?

shadow_7283 wrote:

RHY can do it.  big_smile

Yeah, but RHY is well, RHY.


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i.imgur.com/OZn2RD3.png&amp;link2=http://i.imgur.com/duzaGTB.png&amp;link3=http://i.imgur.com/CrDGvvZ.png&amp;link4=http://i.imgur.com/POEpQyZ.png&amp;link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#14 2010-08-14 14:33:58

shadow_7283
Scratcher
Registered: 2007-11-07
Posts: 1000+

Re: Does anyone know of a way to do collision sensing without hitests?

No. It isn't that hard. Do you wanna know the secret?

Offline

 

#15 2010-08-14 14:50:53

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: Does anyone know of a way to do collision sensing without hitests?

Color sensing.  big_smile


Hai.

Offline

 

#16 2010-08-14 14:59:35

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Does anyone know of a way to do collision sensing without hitests?

shadow_7283 wrote:

No. It isn't that hard. Do you wanna know the secret?

I was kinda kidding.  tongue


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i.imgur.com/OZn2RD3.png&amp;link2=http://i.imgur.com/duzaGTB.png&amp;link3=http://i.imgur.com/CrDGvvZ.png&amp;link4=http://i.imgur.com/POEpQyZ.png&amp;link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#17 2010-08-14 17:05:05

iCode-747
Scratcher
Registered: 2009-11-21
Posts: 1000+

Re: Does anyone know of a way to do collision sensing without hitests?

fg123 wrote:

Color sensing.  big_smile

*points at fg123*

Bingo!  big_smile

Color sensing is the way to go.  wink


-End Transmission-

Offline

 

#18 2010-08-14 17:15:09

shadow_7283
Scratcher
Registered: 2007-11-07
Posts: 1000+

Re: Does anyone know of a way to do collision sensing without hitests?

I can't stand color sensing. Anyway, to collide without any annoying color sensing or extra sprites or extra costumes, you just use this script on top of whatever movement script you have (preferably with velocity)

When Green Flag Clicked
Forever
(velocity stuff)

change x by (x velocity)
if touching platforms
change x by 0 - (x velocity)
set x velocity to 0

And then you can do the y stuff

change y by (y velocity)
if touching platforms
set y velocity to 0

And after that if you have gravity then you will be brought back down.

Offline

 

#19 2010-08-14 17:15:23

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Does anyone know of a way to do collision sensing without hitests?

iCode-747 wrote:

fg123 wrote:

Color sensing.  big_smile

*points at fg123*

Bingo!  big_smile

Color sensing is the way to go.  wink

Oh. Well I counted that in the "hit-test" category, so I didn't mention it. I kinda thought that's what he meant.  tongue


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i.imgur.com/OZn2RD3.png&amp;link2=http://i.imgur.com/duzaGTB.png&amp;link3=http://i.imgur.com/CrDGvvZ.png&amp;link4=http://i.imgur.com/POEpQyZ.png&amp;link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#20 2010-08-14 22:53:32

Locomule
Scratcher
Registered: 2009-08-24
Posts: 500+

Re: Does anyone know of a way to do collision sensing without hitests?

The orginal PacMan uses a tile system to control movement, collisions, etc. When 2 sprites occupy the same tile, they "collide." See my unfinished PacMan  project for an example although I'll warn you now, it may seem a little complicated.

http://scratch.mit.edu/projects/Locomule/1184164


aka Pain from DragonSpires, Delrith Online, BotBattle, Urban Dead etc etc lol

Offline

 

#21 2010-08-14 23:14:26

AtomicBawm3
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Does anyone know of a way to do collision sensing without hitests?

As I said, the list method will work, but the equation will be big and your list has to be exactly right.  Out of curiosity, how many tiles would fit on your pacman board?


http://i50.tinypic.com/j0yw0p.jpg

Offline

 

#22 2010-08-15 01:09:21

Locomule
Scratcher
Registered: 2009-08-24
Posts: 500+

Re: Does anyone know of a way to do collision sensing without hitests?

Rather than hijack this post, I have made a new one with a ton of details behind making your own PacMan using Scratch. You can read it here


aka Pain from DragonSpires, Delrith Online, BotBattle, Urban Dead etc etc lol

Offline

 

#23 2010-08-15 01:19:01

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: Does anyone know of a way to do collision sensing without hitests?

Yeah, some one in prism posted that.
http://home.comcast.net/~jpittman2/pacman/pacmandossier.html


Hai.

Offline

 

#24 2010-08-15 04:51:10

juststickman
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: Does anyone know of a way to do collision sensing without hitests?

Well, move, check if you're in a wall, move back is the basic idea:
http://scratch.mit.edu/projects/justtes … an/1246644


http://is.gd/iBQi2 Add grob to your sig and help with world dominiation!http://is.gd/iBQ9Q                                                             Hey guys, we're seriously naming our team bob?

Offline

 

#25 2010-08-15 13:29:59

shadow_7283
Scratcher
Registered: 2007-11-07
Posts: 1000+

Re: Does anyone know of a way to do collision sensing without hitests?

shadow_7283 wrote:

I can't stand color sensing. Anyway, to collide without any annoying color sensing or extra sprites or extra costumes, you just use this script on top of whatever movement script you have (preferably with velocity)

When Green Flag Clicked
Forever
(velocity stuff)

change x by (x velocity)
if touching platforms
change x by 0 - (x velocity)
set x velocity to 0

And then you can do the y stuff

change y by (y velocity)
if touching platforms
set y velocity to 0

And after that if you have gravity then you will be brought back down.

*bump* That's really the best way to do it!

Offline

 

Board footer