简体   繁体   中英

SVG beyond bounds of sprite in AndEngine

I am using SVG extension in andengine.

This is how i load in my svg textures

 this.hugoRegion =  SVGBitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(this.hugoBuildableTextureAtlas, this, "Hugo_Sprite.svg",Width,Height,Columns, Rows);

As you see i have the the tiled region.

Everything works fine until i attach the player sprite that uses the svg to the scene and it extends the sprite beyond the image. If it collides with another sprite it collides like a meter away from the sprite's body.

For example her is a sprite, where the red box is thats how far the sprite is extended. I want it to WRAP exactly around the image..

在此处输入图片说明 Anyone ever ran into this issue?

I dont think that would be possible .... you need to create the svg such that it wraps the sprite, programmically that would be tough to achieve...

2nd way would be, if you dont want to re-create the svg then, i guess create a rectangle in your class which extends sprite, keep the rectangle dimensions such that it wraps the sprite and then implement the collides with function with the rectangle instead of whole svg. 在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM