Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: GM6 Mask Change Help.  (Read 1500 times)

0 Members and 1 Guest are viewing this topic.
GM6 Mask Change Help.
« on: November 08, 2007, 02:55:40 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 640
Hey guys.
I've tried a few ways to make my char change the mask without getting stuck on a wall but everything I tried failed.
I made him change mask with this:
Code: [Select]
if global.pose="stand"
{
mask_index=sprMask8x8
}
else if global.pose="crawl"
{
mask_index=sprMask16x16
}
But if he is standing and then changes to crawl close to a wall...he'll get stuck in it.
So I tried this:
Code: [Select]
if global.pose="stand"
{
mask_index=sprMask8x8
}
else if global.pose="crawl" && !place_meeting(x,y,objWall)
{
mask_index=sprMask16x16
}
Yet it doesn't work, he keeps getting stuck if he changes from stand to crawl close to a wall.
Does anybody know a way to fix this?.
Thanks in advance and sorry to bother.
Logged
This is an english website, please speak it.
l0l wut? o_0
Re: GM6 Mask Change Help.
« Reply #1 on: November 08, 2007, 03:26:59 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 458
Can you tell us what type of game this is for? Side-scroller? Top-down Zelda? It would help give us a clearer picture of how the mask is supposed to behave.
Logged
Re: GM6 Mask Change Help.
« Reply #2 on: November 08, 2007, 03:31:21 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 640
Top-Down Zelda...
The wall it's 16x16 Link's mask when standing it's 8x8 and when crawling it's 16x16.
When close to a wall and going from stand(8x8) to crawl(16x16) it gets stuck...
Logged
This is an english website, please speak it.
l0l wut? o_0
Re: GM6 Mask Change Help.
« Reply #3 on: November 08, 2007, 04:22:26 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 458
Okay, I see what you mean.

Are you using 100% custom graphics or something? If not, I'm assuming the crawling sprites are customs. If they're based on an established style, are they really twice the size of the standing sprite?

Because of the top-down view and the way depth is simulated in Zelda games, Link's mask should occupy the area of the ground he's standing on, and his feet should be planted squarely in the middle of the mask - as I'm quite sure you have it.

But 8 x 8 for that area seems too small to me - I forget what I use but I know it's bigger than that. And 16 x 16 seems too big because, if he's crawling facing down, for example, he might occupy 16 pixels head-to-foot but the mask wouldn't change in horizontal size. Link hasn't grown sideways, so you'd find him colliding with objects he's nowhere near.

The easiest solution, and what I would do, is not to switch the mask size at all. Increase the mask sprite's size to maybe 10 x 10 or 12 x 12 (although Link's mask should really be the same/similar rectangular proportions as his shadow to account for depth-of-field but that's your call) and use it for both standing and crawling.

If you feel it doesn't look right, another solution would be to, upon whatever keypress changes from standing to crawling, check for collisions in the area the bigger mask will occupy and if there are any, have the Link object 'push' away from those points a pixel at a time until there is no collision* and it fits nicely, then complete the mask change.

*If the mask must be 16 x 16 it can't collide with more than two 16 x 16 walls at a time and should never get stuck.

It does sound like you're making life difficult for yourself though... :P
Logged

mit

Re: GM6 Mask Change Help.
« Reply #4 on: November 08, 2007, 04:28:14 pm »
  • QBASIC programmer since age 4. Take that, world.
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 1079
You method isn't working because you're still checking if you're colliding with the wall before you change the mask.

If your mask's origin is in the centre of the sprite, you could check the distance to the nearest wall, but a better way is this:

Code: [Select]
if global.pose="stand"
{
mask_index=sprMask8x8
}
else if global.pose="crawl"
{
mask_index=sprMask16x16
 if place_meeting(x,y,objWall) {
 global.pose="stand"
 mask_index=sprMask8x8
 }
}

It changes, and then if you're colliding, it changes back.
Logged
Programmer / Spriter / Level designer / Game Director / Web Designer / Music Sequencer for
Random Highscore table:

Play the Kousou Arcade today!
  • Kousou Games
Re: GM6 Mask Change Help.
« Reply #5 on: November 08, 2007, 04:42:15 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 640
...No...let me try to see if I can explain this.
All sprites are 16x16 not 8x8, when I said 8x8 I meant a 16x16 sprite and the "bounding box" are:
Left:4
Right:11
Top:8
Bottom:15
And the one I said 16x16 it's a full 16x16 square....does that makes sense so far? xD
Wait...Yay! Mit, that code worked...Thanks and sorry for getting you guys confused. xD
Logged
This is an english website, please speak it.
l0l wut? o_0
Re: GM6 Mask Change Help.
« Reply #6 on: November 09, 2007, 01:54:15 pm »
  • 笑い男
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 2124
i havent read everything, but it just sounds like you get right next to the wall with an 8x8 mask, then suddenly change to 16x16 so of course it overlaps with the solids in the wall and you get stuck.

if you change it so you dont use the crap gm collision checking to make you stop moving, but just check to see if the place where you want to move to is free, in the movement code, it then shouldnt matter if you want to move away from the wall even if you're in it but if you want to move in it, it wont allow you (may have to make link not solid though), if you can do that sort of thing :/
Logged

この世に悪があるとすれば、それは人の心だ
  • .hack//The World
Re: GM6 Mask Change Help.
« Reply #7 on: November 09, 2007, 05:29:18 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 640
Attacks EDGE with Confusion.
huh? o_0
It's already fixed, thanks.
Logged
This is an english website, please speak it.
l0l wut? o_0
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.231 seconds with 51 queries.

anything