Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Sprite Physics Gap help

Author
Message
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 23rd Feb 2021 01:22
So here is my Problem

I'm experimenting on a side puzzle game

When I set my Sprites to Collision

There is a big Gap from the ground to the Player sprite

How do i sit my sprite player to the ground sprite?

Somehow the uv border is hidden due to it is a animated sprite but it is way to big for collision.
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 23rd Feb 2021 01:51
without seeing the image(s) used for the sprite, i imagine there is some/a large amount of transparency surrounding the actual graphic (i've noted a lot of "useless" transparency surrounding craftpix.net images, for example).

so, set the sprite's collision shape to match the actual graphics, or remove the outer transparency from the image(s)?

again, without seeing the spritesheet itself, the above is just a guess.
[My Itch.io Home] [Now Playing]
[AGK Resource Directory] [TGC @ GitHub]
[CODE lang=agk] YOUR CODE HERE [/CODE]
[VIDEO=youtube] VIDEO ID [/VIDEO]
[Google Forum Search]
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 23rd Feb 2021 03:12 Edited at: 23rd Feb 2021 03:15


Hi, ok here is a picture for better understanding

Sorry

Attachments

Login to view attachments
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 23rd Feb 2021 03:39 Edited at: 23rd Feb 2021 03:53
i understood that the character's feet aren't touching the ground but without the actual character image(s) i can't be sure if my previous suggestions would rectify.

if you're not adjusting the collision shape at all, i'm nearly sure that you need to, otherwise.

in this example, the sprite's collision box is the same size as the (64x64) image itself, by default. the part that i want to stand on the ground/bottom of the screen is the red box:

here, the collision shape/box is resized to fit the red box (32x32), or "character" in your case, to account for surrounding alpha transparency within the same 64x64 image:

...manually setting the collision box with SetSpriteShapeBox(ThisSprite,-16,-16,16,16,0.0) the only difference in the code.

you could easily see if my suggestion would work using SetPhysicsDebugOn() which would reveal the sprite's shape. ie, see if the shape itself is, indeed, resting on the ground.
[My Itch.io Home] [Now Playing]
[AGK Resource Directory] [TGC @ GitHub]
[CODE lang=agk] YOUR CODE HERE [/CODE]
[VIDEO=youtube] VIDEO ID [/VIDEO]
[Google Forum Search]

Attachments

Login to view attachments
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 23rd Feb 2021 04:10
Thanks Virtual Nomad


That helped

They should have made all collision boxes fit perfectly unless needed, not the other way around.

Login to post a reply

Server time is: 2024-04-19 23:22:11
Your offset time is: 2024-04-19 23:22:11