Can we making a behavior to loading a SpriteSheet

0 favourites
  • 13 posts
From the Asset Store
Make your own platformer for both the web and mobile easy with this Santas Platformer Template, FULLY DOCUMENTED
  • Dear Everyone,

    I have image of SpriteSheet with 52 card like below.

    I'm going to making a behavior to load it and separate it in to 52 images. (I already have a SpriteA on GameLayout with 52 empty frame)

    Can we do it?

    (Note: the reason I have to do it: The Game like this. You start game with a basic set card, but User can choose his prefer Theme or Card Set, and we have >100 theme and Card set. (1 card set have 52 image, 100 card set will have 5200 images. I cann't put them all in the Project, so I have to load it on realtime, when User click to choose theme)

  • Dear Mr Ashley, Can we do like above ?

    If possible, could you please help to give me some documents, SDK function, or any reference relate to it?

  • yeah you can totally do it with just events no biggie !!!

  • yeah you can totally do it with just events no biggie !!!

    Did you mean using canvas, paste image at position x,y with size of one Card, then after that paste that to Image Frame ?

  • what I do in mine is i move the image streamable.com/xz856n because drawing canvas won'T work out of the screen.

  • Behaviors are not designed to be able to draw anything. So you shouldn't use a behavior for anything like this.

    I don't see why you need any special handling for this though. Why not just import all 52 images as frames of a sprite? Your project will still have the same amount of image data in it either way, so you're not actually saving anything by putting images in project files.

  • Behaviors are not designed to be able to draw anything. So you shouldn't use a behavior for anything like this.

    I don't see why you need any special handling for this though. Why not just import all 52 images as frames of a sprite? Your project will still have the same amount of image data in it either way, so you're not actually saving anything by putting images in project files.

    Dear Mr Ashley, We have more than 100 card set, each card set will have 52 card image. So 100 card set will be 5200 card images, I cann't put them all into Project. This is so large resource, It's will make very long loading.

    So, our idea is:

    1. User will start game will a set of Classic Card.

    2. When User choose other Set Card, Game will load that Card Set SpriteSheet

    3. When new Card Set SpriteSheet was loaded, 52 frame images of Card in Game will be replaced with new Card from new CardSet SpriteSheet.

  • You could use sprite mesh distort to do that. You just change the texture coordinates to display a different sub-image.

    Here it's using a spritesheet with a grid of 13x6 sub-images.

    dropbox.com/s/dog9plqg9vicvk5/card_spritesheet.c3p

    Toggle the set mesh point actions to disable the rotation.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You could use sprite mesh distort to do that. You just change the texture coordinates to display a different sub-image.

    Here it's using a spritesheet with a grid of 13x6 sub-images.

    https://www.dropbox.com/s/dog9plqg9vicvk5/card_spritesheet.c3p?dl=1

    Toggle the set mesh point actions to disable the rotation.

    I think you could do that with Tiled Background's image offset.

    Aside from the card flip thing.

  • Oh yeah. Forgot about tiledbackground. Probably would be simpler.

  • > You could use sprite mesh distort to do that. You just change the texture coordinates to display a different sub-image.

    >

    > Here it's using a spritesheet with a grid of 13x6 sub-images.

    > dropbox.com/s/dog9plqg9vicvk5/card_spritesheet.c3p

    > Toggle the set mesh point actions to disable the rotation.

    I think you could do that with Tiled Background's image offset.

    Aside from the card flip thing.

    Thank newt R0J0hound for you idea.

    I also think about it, but with both of your way, I have to re-code my all game (we have about 14 Type Card Game already finished, just make some optimize for loading and add Theme and Card Set), And in Game, I have some tween about Width and Height of the Card to make some special effect, so I cann't use Tile in this case (Width and Height change).

  • > > You could use sprite mesh distort to do that. You just change the texture coordinates to display a different sub-image.

    > >

    > > Here it's using a spritesheet with a grid of 13x6 sub-images.

    > > dropbox.com/s/dog9plqg9vicvk5/card_spritesheet.c3p

    > > Toggle the set mesh point actions to disable the rotation.

    >

    > I think you could do that with Tiled Background's image offset.

    > Aside from the card flip thing.

    Thank newt R0J0hound for you idea.

    I also think about it, but with both of your way, I have to re-code my all game (we have about 14 Type Card Game already finished, just make some optimize for loading and add Theme and Card Set), And in Game, I have some tween about Width and Height of the Card to make some special effect, so I cann't use Tile in this case (Width and Height change).

    Actually you can, use the image scale parameters accordingly.

    Let's say your cards have 64x64 px size, and you have 64 cards on the sheet in an 8x8 grid.

    The tiled background layout size is 64x64. Use the image offset to navigate to the desired card on the sheet. E.g. OffsetX set to 64 shows the next card on the sheet.

    Now, you can use the image scale parameter to simulate a card flipping effect. If the TiledBG layout size is set to 32x64, set the image scale X to 50% to squeeze the card. If you tie the image scale to your tween effect, it should be no problem at all.

  • I would probably use DrawingCanvas - spawn 52 canvas instances over the spritesheet and paste it. Then you can load the images into frames of the Card sprite.

    Or you can use DrawingCanvas instances directly as cards. You should be able to tween their width/height, and rotation is also supported now.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)