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

#1 2008-12-20 08:56:42

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Need help with array based hit detection

Ok, this is what I have so far.
http://scratch.mit.edu/projects/archtest/357238

It works well except you can go into corners and you move into the ground sometimes.
I think I need to make it so that it can detect corners and snap to the edges of tiles.

Any help would be appreciated.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#2 2008-12-20 10:29:55

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Need help with array based hit detection

Hmm...well could you have the detection like in Archknight's Adventure? Because there it was pretty good. Still not perfect, but it was better.


http://i.imgur.com/WBkM2QQ.png

Offline

 

#3 2008-12-20 11:04:06

Dan01
Scratcher
Registered: 2008-06-11
Posts: 100+

Re: Need help with array based hit detection

Lucario621 wrote:

Hmm...well could you have the detection like in Archknight's Adventure? Because there it was pretty good. Still not perfect, but it was better.

You don't understand... He's using array based detection in order to make the size of his SSBB game smaller. He isn't asking for a new kind of sensing, he is asking how to improve this one.

Btw, I don't have a clue Archmage  tongue


http://img3.imageshack.us/img3/4743/ubd6522wp8.png
http://img3.imageshack.us/img3/4667/ubd3758ox2.png

Offline

 

#4 2008-12-20 11:38:15

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Need help with array based hit detection

Lucario621 wrote:

Hmm...well could you have the detection like in Archknight's Adventure? Because there it was pretty good. Still not perfect, but it was better.

No, you don't understand. It doesn't use any sensing block in the entire project. Instead it detects values in the array.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#5 2008-12-20 13:22:55

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Need help with array based hit detection

Dan01 wrote:

Lucario621 wrote:

Hmm...well could you have the detection like in Archknight's Adventure? Because there it was pretty good. Still not perfect, but it was better.

You don't understand... He's using array based detection in order to make the size of his SSBB game smaller. He isn't asking for a new kind of sensing, he is asking how to improve this one.

Btw, I don't have a clue Archmage  tongue

To me, I care more about quality than file size  tongue


http://i.imgur.com/WBkM2QQ.png

Offline

 

#6 2008-12-20 13:27:19

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Need help with array based hit detection

Also, far as I know, nobody but you and S65 can understand this XD. Anyway It might have a smaller file size but the movement isn't as good and stuff......*barf*......the movement made me barf you sicko!

But also, I don't think its reasonable to have over 100 sprites in the end.

Last edited by Lucario621 (2008-12-20 13:28:10)


http://i.imgur.com/WBkM2QQ.png

Offline

 

#7 2008-12-20 14:42:37

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Need help with array based hit detection

Lucario621 wrote:

Also, far as I know, nobody but you and S65 can understand this XD. Anyway It might have a smaller file size but the movement isn't as good and stuff......*barf*......the movement made me barf you sicko!

But also, I don't think its reasonable to have over 100 sprites in the end.

The movement can be changed, easily. What is important is the hit detection. This is how most game developers make their games, so doing things this way is far superior to using large drawn sprites.

Games that use this kind of tile based system:
-All 2d mario games
-All non 3D zelda games
-Heli attack 3
-All 2d final fantesy games
-pokemon games
the list goes on and on...

The movement is bad partly because of lag and partly because the number values involved in the movement need to be changed. But, using this is the ONLY way to make a perfect clone of a game like the original mario bros. There is no way to make an accurate clone using an art based method.

Last edited by archmage (2008-12-20 15:02:20)


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#8 2008-12-20 15:09:45

Dan01
Scratcher
Registered: 2008-06-11
Posts: 100+

Re: Need help with array based hit detection

Could you explain how it works, as it sounds like a good method, but I've had a look at the scripts and they're confusing.


http://img3.imageshack.us/img3/4743/ubd6522wp8.png
http://img3.imageshack.us/img3/4667/ubd3758ox2.png

Offline

 

#9 2008-12-20 15:33:27

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Need help with array based hit detection

The best tutorial on tile based games on the net is located @ http://www.tonypa.pri.ee/tbw/

It is in actionscript and it cannot be perfectly translated into scratch unfortunately.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#10 2008-12-20 16:13:57

Dan01
Scratcher
Registered: 2008-06-11
Posts: 100+

Re: Need help with array based hit detection

archmage wrote:

The best tutorial on tile based games on the net is located @ http://www.tonypa.pri.ee/tbw/

It is in actionscript and it cannot be perfectly translated into scratch unfortunately.

Well I read it, but since I have no knowledge of Flash I didn't understand much  tongue

I was wondering, if you could give me a short tutorial on how to do Pathfinding, using tiles, as that would work great on some games.


http://img3.imageshack.us/img3/4743/ubd6522wp8.png
http://img3.imageshack.us/img3/4667/ubd3758ox2.png

Offline

 

#11 2008-12-20 19:06:22

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Need help with array based hit detection

Here is a tutorial of A* path finding.
http://www.policyalmanac.org/games/aStarTutorial.htm

However, I doubt that scratch could even run it quickly enough.

As for using tiles in scratch, there is a small tut by addzero on this thread.
http://scratch.mit.edu/forums/viewtopic.php?id=11632

It would be really ideal for a zelda type game.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#12 2008-12-20 20:25:09

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Need help with array based hit detection

Cool and handy stuff, just got to translate that into scratch.


http://i.imgur.com/WBkM2QQ.png

Offline

 

#13 2008-12-20 21:05:14

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Need help with array based hit detection

Also I made a collision type thing. But if you see it I know what your going to say: it uses the sensor blocks. True. but what I did is Player 1 stamps the stage based on the list (like AddZero was talking about storing in lists) and then player one can move in the stage. 1 sprite to make the stage and move through the stage, and 4 sprites for sensors to tell if P1 is touching the walls. Different, but still nice.


http://i.imgur.com/WBkM2QQ.png

Offline

 

#14 2008-12-20 22:52:41

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Need help with array based hit detection

Yeah, for my cat level creator project I got lazy and just put in colour sensing. The lack of multidimensional arrays makes things much more difficult.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#15 2008-12-21 03:22:56

JSO
Community Moderator
Registered: 2007-06-23
Posts: 1000+

Re: Need help with array based hit detection

http://scratch.mit.edu/projects/JSOlabs/358269 - the level editor for all the following projects

http://scratch.mit.edu/projects/JSOlabs/358270 - my first (kind of silly) attempt.

The movement is sluggish but you can't move through walls, floors, and ceilings  big_smile
For the movement it uses a "previous x" and "previous y"...


http://oi48.tinypic.com/2v1q0e9.jpg

Offline

 

#16 2008-12-21 12:54:26

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Need help with array based hit detection

JSO, I took yours and mine (mainly yours) and made it only a 1 sprite and 1 script project.


http://i.imgur.com/WBkM2QQ.png

Offline

 

#17 2008-12-21 13:16:00

JSO
Community Moderator
Registered: 2007-06-23
Posts: 1000+

Re: Need help with array based hit detection

I made a new, way better one:

http://scratch.mit.edu/projects/JSOlabs/358371

It has x and y velocity and is lighter.


http://oi48.tinypic.com/2v1q0e9.jpg

Offline

 

#18 2008-12-22 11:35:34

JSO
Community Moderator
Registered: 2007-06-23
Posts: 1000+

Re: Need help with array based hit detection

I made a third, probably the last one:

http://scratch.mit.edu/projects/JSOlabs/359651

It's based upon .2 but I fixed some glitches. It works fine for me.
Archmage, do you mind if I turn this into a create-your-game project?


http://oi48.tinypic.com/2v1q0e9.jpg

Offline

 

#19 2008-12-22 11:37:34

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Need help with array based hit detection

JSO wrote:

I made a third, probably the last one:

http://scratch.mit.edu/projects/JSOlabs/35965177

It's based upon .2 but I fixed some glitches. It works fine for me.
Archmage, do you mind if I turn this into a create-your-game project?

Do what you want to do. You should have to ask for my permission  tongue


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#20 2008-12-23 12:27:24

bubble-07
Scratcher
Registered: 2008-03-25
Posts: 17

Re: Need help with array based hit detection

Lol it's TI-BASIC all over again!!! Only with TI-BASIC, everything was an incredibly tedious task... Ah, the fun days...

Offline

 

Board footer