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 / I think there is bug about SetSpriteShape, when the image is in the atlas texture.

Author
Message
halley
13
Years of Service
User Offline
Joined: 27th Apr 2011
Location: China
Posted: 24th Dec 2011 07:01
When I load a sprite from a texture, then SetSpriteShape. I found there is a mistake. The Collision shape is always the image from (0,0) position of the texture.

The Miracrea Games
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 24th Dec 2011 11:37
That sounds like a good bug

Could you reproduce it with a simple example and post it on the bug board?

The Zoq2
15
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 24th Dec 2011 13:00
Have you tried to update the shape when you animate it, I don't think it shuld update automaticly...
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 24th Dec 2011 13:02
Good point, I assumed he was updating it.

halley
13
Years of Service
User Offline
Joined: 27th Apr 2011
Location: China
Posted: 24th Dec 2011 13:13
May I ask how to update it ? use AGK::Update() ? it said Sync() can auto call it.

The Miracrea Games
halley
13
Years of Service
User Offline
Joined: 27th Apr 2011
Location: China
Posted: 24th Dec 2011 13:17
@Zoq2, what's your meaning?

The Miracrea Games
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 24th Dec 2011 13:21 Edited at: 24th Dec 2011 13:22
In tier 1 if you call setSpriteShape(sprID, 3) after you change the image the shape will be readjusted. Never tried it on an atlas texture though...

halley
13
Years of Service
User Offline
Joined: 27th Apr 2011
Location: China
Posted: 24th Dec 2011 13:27
The situation is different, it was not to readjusted. But only use the image at (0,0) position in texture.

@baxslash, Maybe you can write a test project to test what I said.

The Miracrea Games
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 24th Dec 2011 14:49
I will, but it will have to wait till after Christmas now I'm afraid...

halley
13
Years of Service
User Offline
Joined: 27th Apr 2011
Location: China
Posted: 2nd Jan 2012 14:17
I hope someone can give me a hand.

The Miracrea Games
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 2nd Jan 2012 19:56
Halley, send me an email and I might remember to do some tests on this problem, or have you fixed it?

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 3rd Jan 2012 12:44
Attached is a working example (sorry for the double post but there was no reply and I didn't want halley to miss the answer).

The shape redefines perfectly for me as long as I use "setSpriteShape" after changing the animation frame.

Attachments

Login to view attachments
halley
13
Years of Service
User Offline
Joined: 27th Apr 2011
Location: China
Posted: 4th Jan 2012 08:29
@baxslash, I think the situation is different from what you said. I used TurnDebugOn() to see the outline of the collision shape ,it was totally not right. and I added SetSpriteShape(), it didn't work.

The Miracrea Games
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 4th Jan 2012 09:39
Sorry halley, what command is that? I am using the command "setPhysicsDebugOn()" in my example (attached in my previous post) and it updates the shape just fine. I can't find any other debug commands?

halley
13
Years of Service
User Offline
Joined: 27th Apr 2011
Location: China
Posted: 4th Jan 2012 10:00
I watched your test project. The situation is really different. There is no atlas texture in your project. The bug is related with atlas texture. Your project didn't meet the bug.

Can you use a atlas texture ? Then you can understand what I said.

The Miracrea Games
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 4th Jan 2012 10:11
Quote: "There is no atlas texture in your project."

Isn't an atlas texture just a single image with multiple images on? Maybe you are loading the images differently?

I load the image "loadImage(1,"shapes.png")" which has four subimages then use "setSpriteAnimation(1, 128, 128, 4)" to let AppGameKit split the image into four.

I assume you are using "loadSubImage" and either setting the image or adding animation frames, that being the case perhaps it would be easier if you provided an example of the problem?

bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 4th Jan 2012 10:13
Atlas textures have their limitations.
Better not use them if you plan to use UV, etc...
halley
13
Years of Service
User Offline
Joined: 27th Apr 2011
Location: China
Posted: 4th Jan 2012 10:28
@baxslash: I'll try to give a example later.

Maybe bjadams is right. Atlas textures have their limitations.

The Miracrea Games
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 5th Jan 2012 11:27
what is the advantage of atlas files after all?
its better to use single picture files, it's more manageable especially for small game projects
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 5th Jan 2012 11:35
Quote: "what is the advantage of atlas files after all?"

It depends on the images you're using. If you have a lot of different shaped sprites, long and thin images particularly then you're better off using an atlas texture as for each image that's 32x128 (for example) your app will be using 128x128 of memory. If you can use an atlas texture containing 4 sprites at 32x128 each your app is using 1/4 of the amount of memory for those images.

Login to post a reply

Server time is: 2024-11-22 21:03:02
Your offset time is: 2024-11-22 21:03:02