0 Favourites

Tiled background image offset Help?(Solved)

This forum is currently in read-only mode.
  • I need to find a way to copy and paste images from tiled background into a sprite.

    (actually several instances of the same sprite)

    Iv'e got as far as creating the the image offset x,y events, but i cant work out the rest.

    Ive searched the forums, downloaded loads of caps but still can't get it to work.

    Here's my cap-

    http://dl.dropbox.com/u/22173473/Tile%20copy%20to%20sprite.cap

    Iv'e added comments inside the cap that explain things a bit clearer.

  • Quick addition to above -

    I changed the events in the 'main events group' to-

    + MouseKeyboard: Mouse is over photos

    + System: Always (every tick)

    -> TiledBackground1: Set image offset to photos.Value('valx'), photos.Value('valy')

    + MouseKeyboard: On Left Clicked on photos

    + System: Repeat 2 times

    -> Canvas: Paste TiledBackground1 into canvas

    -> ImageManipulator: Copy image from sprite Canvas

    -> ImageManipulator: Copy image to sprite photos

    After doing this, i didnt have to double click on the 'photos' to paste in the image.

    This doesn't solve the problem (it still pastes to all the sprites) but it stops the 'paste' lag that seems to happen.

    Thanks

  • [quote:34a2fx0d]This doesn't solve the problem (it still pastes to all the sprites)

    The Sprites share the same texture, so if you change the texture on one all of them change. One way you can do it is give the Sprite 16 animation frames and assign each instance a different frame. Another method is use TiledBackground objects instead of sprites. They can each have different textures but only with the load texture action, so you'll have to save the image from the canvas to a file first before loading.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • [quote:2g1q9ttl]This doesn't solve the problem (it still pastes to all the sprites)

    The Sprites share the same texture, so if you change the texture on one all of them change. One way you can do it is give the Sprite 16 animation frames and assign each instance a different frame. Another method is use TiledBackground objects instead of sprites. They can each have different textures but only with the load texture action, so you'll have to save the image from the canvas to a file first before loading.

    In the actual game i need the solution for, i am using a sprite with 9 animations.

    <img src="http://dl.dropbox.com/u/22173473/small%20splash.png">

    These events start when the level loads-

    + PickLevel: On fade out finished

    -> System: Create object puzzlecubes on layer 1 at (488, 272)

    -> puzzlecubes: Set 'numb' to 1

    -> System: Create object puzzlecubes on layer 1 at (240, 272)

    -> puzzlecubes: Set 'numb' to 2

    -> System: Create object puzzlecubes on layer 1 at (616, 408)

    -> puzzlecubes: Set 'numb' to 3

    -> System: Create object puzzlecubes on layer 1 at (752, 152)

    -> puzzlecubes: Set 'numb' to 4

    -> System: Create object puzzlecubes on layer 1 at (648, 152)

    -> puzzlecubes: Set 'numb' to 5

    -> System: Create object puzzlecubes on layer 1 at (328, 416)

    -> puzzlecubes: Set 'numb' to 6

    -> System: Create object puzzlecubes on layer 1 at (304, 152)

    -> puzzlecubes: Set 'numb' to 7

    -> System: Create object puzzlecubes on layer 1 at (744, 408)

    -> puzzlecubes: Set 'numb' to 8

    -> System: Create object puzzlecubes on layer 1 at (400, 152)

    -> puzzlecubes: Set 'numb' to 9

    -> System: Create object lydia on layer 1 at (60, 446)

    -> lydia: Activate Platform movement

    Everything works fine as it is, but i was looking for a way to let the player choose a picture for the puzzle or start the level with a different 'picture' every time.

    If i was to use tiledbackground objects could i still make them pushable blocks (platform behaviour) ?

  • I'd use sprite, tiles are usualy used only as static images. Just click on lydia, than animator tab and in the top window (there is probably the Default animation with 9 frames) right click to add another animation - name it "Image 2" (or whatever) and add 9 frames of the new picture. After, you can add "Image 3" animation for the next picture and so on. Than you can call correct frame with "Set animation" and "Set animation frame" actions.

  • I'd use sprite, tiles are usualy used only as static images. Just click on lydia, than animator tab and in the top window (there is probably the Default animation with 9 frames) right click to add another animation - name it "Image 2" (or whatever) and add 9 frames of the new picture. After, you can add "Image 3" animation for the next picture and so on. Than you can call correct frame with "Set animation" and "Set animation frame" actions.

    Great idea! thanks for your help.

  • I didnt want to start a new thread, so i will ask the question here? (it is related)

    Iv'e got the offset image thingy sorted, but now i'm struggling with the next bit -

    How do i create an event to detect when each puzzleblock is in its correct position within the puzzle.....similar to a jigsaw puzzle.

    I gave each block, 2 private variable's ( 'xpos' and ypos') and set the values of each to the required resting position....ie Square 9 should be at 552, 608 to be correctly placed.

    I tried the following-

    + System: Always (every tick)

    + System: For each puzzlecubes

    + System: puzzlecubes.Value('x') Equal to puzzlecubes.X

    + System: puzzlecubes.Value('y') Equal to puzzlecubes.y

    -> puzzlecubes: Destroy

    but it didnt work?

    Can anybody help me with this?

  • I tried the following-

    + System: Always (every tick)

    + System: For each puzzlecubes

    + System: puzzlecubes.Value('x') Equal to puzzlecubes.X

    + System: puzzlecubes.Value('y') Equal to puzzlecubes.y

    -> puzzlecubes: Destroy

    but it didnt work?

    Can anybody help me with this?

    Sounds like it should work. The always event at the beginning is completely unnecessary btw.

    Are you sure the puzzlecube objects reach the correct positions? I mean maybe they end up being at 552.3467 instead of simply 552? Maybe try it like this:

    + System: puzzlecubes.Value('x') Equal to round(puzzlecubes.X)

    + System: puzzlecubes.Value('y') Equal to round(puzzlecubes.y)

    Other than that, show a cap!

  • >

    > Are you sure the puzzlecube objects reach the correct positions? I mean maybe they end up being at 552.3467 instead of simply 552?

    >

    ...and, I think it is difficult for a player to pixel precise position those blocks, you could add a range. If a block is between i.e. 550-554, it'd snap to the right position.

  • "PixelRebirth

    + System: puzzlecubes.Value('x') Equal to round(puzzlecubes.X)

    + System: puzzlecubes.Value('y') Equal to round(puzzlecubes.y)"

    "Noga

    ...and, I think it is difficult for a player to pixel precise position those blocks, you could add a range. If a block is between i.e. 550-554, it'd snap to the right position"

    What do these expressions actually do?

  • Round(value)

    Rounds value to its nearest whole number, eg. Round(6.9) gives 7

    ...from Construct Manual, which some good man put together

  • Round(value)

    Rounds value to its nearest whole number, eg. Round(6.9) gives 7

    ...from Construct Manual, which some good man put together

    Errm...I didn't read that page

    Anyway i managed to solve the problem by adding some markers.

    <img src="http://dl.dropbox.com/u/22173473/solved.png">

    + System: For each Green

    + puzzlecubes: puzzlecubes overlaps markers

    + puzzlecubes: Value 'numb' Equal to markers.Value('marker')

    -> puzzlecubes: Set animation frame to 10

    -> puzzlecubes: Set X to markers.X

    Thanks to everybody who posted.

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