Pages: 1 2
Topic closed
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.
Offline
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.
Do you maybe mean without using variables Like this? ...
... <if><( <{ Variable 1 }><=> 5)> <change y by( 5<else><change y by( -5
Offline
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.
![]()
It was your rant about not insulting you that bothered me. Everyone is really nice here.
Anyway, when you type blocks, make sure to put [blocks] before them and [/blocks] after or the rest of the post is bold.
Offline
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.
![]()
It was your rant about not insulting you that bothered me.
Everyone is really nice here.
![]()
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.)
Offline
Harakou wrote:
I can't think of any practical way... Why would you want to, anyway?
Can't tell you
Offline
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
I've used a list technique, but that really only works on projects with square pieces.
Offline
steppenwulf wrote:
Harakou wrote:
I can't think of any practical way... Why would you want to, anyway?
Can't tell you
![]()
Can't really help you if you can't at least give us an idea of what you have in mind. And like Atomicbawm3 said, you can use a sort of (distance to _) thing, but it only really works with objects that are round.
Offline
Harakou wrote:
steppenwulf wrote:
Harakou wrote:
I can't think of any practical way... Why would you want to, anyway?
Can't tell you
![]()
Can't really help you if you can't at least give us an idea of what you have in mind.
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.
Offline
steppenwulf wrote:
Harakou wrote:
steppenwulf wrote:
Can't tell you![]()
Can't really help you if you can't at least give us an idea of what you have in mind.
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!
Offline
RHY can do it.
Offline
No. It isn't that hard. Do you wanna know the secret?
Offline
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
iCode-747 wrote:
fg123 wrote:
Color sensing.
![]()
*points at fg123*
Bingo!![]()
Color sensing is the way to go.![]()
Oh. Well I counted that in the "hit-test" category, so I didn't mention it. I kinda thought that's what he meant.
Offline
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
Offline
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?
Offline
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
Offline
Well, move, check if you're in a wall, move back is the basic idea:
http://scratch.mit.edu/projects/justtes … an/1246644
Offline
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
Topic closed
Pages: 1 2