Author Topic: Solidity problem  (Read 6781 times)

Vincent

  • SGDK2 Addict
  • Expert
  • Fanatic
  • *****
  • Posts: 612
  • Legacy of Kain: Revival is completed!!!
    • View Profile
    • Chivalrous Games
    • Email
Solidity problem
« on: 2008-01-10, 03:11:10 PM »
Hi everyone,

Sorry if it is a basic question, but I'm new with SGDK2 and never used SGDK1 so I might be missing some experience or basic concepts, so please indulge me! :baby:

What I'm trying to do:
I'm trying to make a fighting game but not exactly in 2d.  The fighters can move into the background or in the foreground.  So rather than fighting on a single line (the traditional way like Street Fighter 2 - walking left-right, jumping and crouching) they can do all that and move in a semi-isometric way.  (Which is like dodging sideways)  I made a couple of rules so by holding a key the fighters changes from jumping to walking sideways and it works pretty fine but I've got a problem related to solidity.  I explain this problem further down.  There are 3 floors that I've made for the fighter, one in the background, one in the foreground and one between them (all on the same layer).  Depending on the movement entered by the player, the fighter is supposed to react to the solidity of one of these 3 floors.  (I hope I'm not confusing anyone, it is quite hard to explain and my english might not be top notch: I'm a french canadian, so english is my second langage.)

The obstacle I can't overcome for the moment:
For some reason, the fighter is not taking solidity into account.  He falls (beacause of gravity) right through the "supposed" ground.  The thing is that the fighter sprite size is 100 pixels by 100 pixels and the floor tiles are 13 pixels by 14 pixels.  I wonder if this huge difference in size could cause a problem.  I have to say that I followed all the steps the create a normal behavior with solidity (I passed through the tutorial and looked at the sample project) but somethings seems to be missing. 

Here is what I did to create solidity (maybe I did something wrong):
1- I created 3 Tile categories for the floors (MatLow, MatMid and MatHigh)
2- I created 3 Solidity types (One for each)  Each of these solidity specifies one of these floor is to be considered SolidTileShape and the two others are EmptyTileShape.
3- I included the floor tiles in the map layer editor (drawing the 3 floors)
4- In the layer editor, I set the fighter sprite to make him react to one of the three floors by default
5- In the Fighter sprite definition rules I added these rules in this order (maybe the order can be the cause of the problem) (I won't paste each rule's code, but the title of each is quite self-explanatory)
rule 1: scroll player into view
rule 2: inertia
rule 3: animate the fighter to base animation (little jumping on place, the sprite doesn't move, only the images in it)
rule 4: react to solidity
rule 5: snap to ground
rule 6: move by velocity
rule 7: Accelerate by inputs
rule 8: gravity

There are a couple of other rules under certain conditions, but I deactivate them and the problem is still there, so they should not be related to this problem.

Presently, I can make the character move around the mat, jump, etc, but he always falls through the ground.

Is there something I am missing?  Do you need to see the project file to have a more precise idea?  If someone asks me for it, I would gladly share or show what I've done, but the game is still in it's very early development phase!

Thank you for your time!  :)
Legacy of Kain: Revival completed!
http://lokrevival.webs.com

See also my company website:
http://chivalrousgames.com

Tanja

  • Clever
  • Fanatic
  • ***
  • Posts: 606
    • View Profile
Re: Solidity problem
« Reply #1 on: 2008-01-10, 03:46:57 PM »
did you give your fighter a collision rectangle? since the fighter is 100x100 and the floor so much smaller, i would first try to make the floors bigger.

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Solidity problem
« Reply #2 on: 2008-01-10, 05:46:39 PM »
The size shouldn't be a problem.  Try submitting your project to http://sgdk2.enigmadream.com/support/ (and let me know if you do) and I can look to see if I can make sense of it.

Vincent

  • SGDK2 Addict
  • Expert
  • Fanatic
  • *****
  • Posts: 612
  • Legacy of Kain: Revival is completed!!!
    • View Profile
    • Chivalrous Games
    • Email
Re: Solidity problem
« Reply #3 on: 2008-01-11, 08:43:24 AM »
Hi,

To Morgengrauen:
Do you mean a collision mask?  I believed, from what I read, (correct me if I'm wrong) that it was only use to calculate collisions between 2 sprites?  Since the floor in this case is not defined as a sprite, should it not be relevant?  I will try this in case it would make a difference.

To bluemonkmn:
I just submitted my project files.  I imported some images in it, so it might be a little big.  Tell me if some files are missing: I'm still unfamiliar with the program structure.  By the way, these images will change eventually, I ripped them from a snes ROM to work with something while my friend is actually drawing the real pictures.  So there won't be any copyright problems.

Thanks a lot for your help! :)
Legacy of Kain: Revival completed!
http://lokrevival.webs.com

See also my company website:
http://chivalrousgames.com

Tanja

  • Clever
  • Fanatic
  • ***
  • Posts: 606
    • View Profile
Re: Solidity problem
« Reply #4 on: 2008-01-11, 09:00:48 AM »
if i remember right, a collision mask is for collisions with sprites. but there is still the collision rectangle. by default, it should be the size of your fighter graphic. (maybe the default size is 32x32,  you could try that out)
you can edit the col. rectangle in size and position, so that it matches your sprite. it is used for collision detection between your sprite and all solid tiles.
feel free to look at the help files for that, i used it a lot.

Vincent

  • SGDK2 Addict
  • Expert
  • Fanatic
  • *****
  • Posts: 612
  • Legacy of Kain: Revival is completed!!!
    • View Profile
    • Chivalrous Games
    • Email
Re: Solidity problem
« Reply #5 on: 2008-01-11, 11:06:08 AM »
I did change the collision rectangle (changing it from 32x32 to 100x100) and it solved the problem!
Thanks a lot!

 ;D
Legacy of Kain: Revival completed!
http://lokrevival.webs.com

See also my company website:
http://chivalrousgames.com

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Solidity problem
« Reply #6 on: 2008-01-11, 05:08:23 PM »
OK, I must grant Morgengrauen a (just created) forum rank of "Clever" for that answer.  8)
Good call.

Tanja

  • Clever
  • Fanatic
  • ***
  • Posts: 606
    • View Profile
Re: Solidity problem
« Reply #7 on: 2008-01-11, 05:10:00 PM »
 :laugh: lol.... thanks!