CyclePuzzle

  • #1, by unrealMonday, 02. February 2015, 18:59 10 years ago
    Hello guys,

    I want to make a simple puzzle game using the rotation script and a bunch of conditions (to experiment and learn), the problem is that I can't manage to make more than 1 rotation of a piece of puzzle. I suspect the script to work only once because the image is already rotated (related to the original position).

    You can download the project (Vis 4.01) to try it out and see what's wrong. My goal is to make a more complex puzzle based on 'values', this one is based on 'conditions' (2 positions for one piece). And then give it to the Vis community as an exemple of puzzle.

    A little help maybe ?

    DOWNLOAD PROJECT FILE

    Game WIN
    Game MAC

    EDIT :
    The version above doesn't work, here is a working version by Blink3D :
    Blink3D version

    Newbie

    66 Posts


  • #2, by afrlmeMonday, 02. February 2015, 19:08 10 years ago
    Um you haven't actually linked to the file. You've linked to the storage websites homepage! razz

    Imperator

    7278 Posts

  • #3, by unrealMonday, 02. February 2015, 19:18 10 years ago
    Ok thanks, I've corrected the link. But actually the "Download link" field didn't want my link, probably because of the wicked link of MEGA.

    Newbie

    66 Posts

  • #4, by afrlmeMonday, 02. February 2015, 21:16 10 years ago
    I'm looking into it. I've revised the workflow rotation script some, so that it is possible to rotate object based on sprites center or based on pixel position.

    Not quite finished yet though. I would recommend not having it spin like that. Probably better to have it statically jump between each rotation instantly. Also These sort of puzzles usually tricker as one ring will often move another ring at the same time in one direction or the other. Also you could consider adding reverse rotation with right click.

    Quick note: you did not have to draw around the exact shape of the ring inner edges because the layer order of the objects will control which object area is accessible - kind of like how a mask works.

    Imperator

    7278 Posts

  • #5, by afrlmeTuesday, 03. February 2015, 03:06 10 years ago
    https://www.dropbox.com/s/tbm3v3p0zf0zjw1/CyclePuzzle.zip?dl=0

    Turns out that it's quite complicated. I ended up rewriting the rotation function from scratch specifically for rotating based on the amount of sides of the shape. The script is unique to the puzzle.

    There was some weird bug I kept getting when trying to rotate by adding + 60 to the current rotation value. Each time it got to 240º it would end up setting the next one at 299.99º instead of 300 which meant that it didn't end up resetting back to 0 which was messing up the puzzle, so I ended up having to round up the min & max value (closet round number based on decimal).

    Imperator

    7278 Posts

  • #6, by unrealTuesday, 03. February 2015, 15:16 10 years ago
    Nice idea ! But I was just trying to understand why I cannot move a ring more than one time, now I don't understand anything ^^. The puzzle is now more complex (6 positions and coercive ring movements), I don't know if it's my version of Visionaire (v4.01) but the rings don't rotate from the center so I can't see what I'm doing

    Newbie

    66 Posts

  • #7, by afrlmeTuesday, 03. February 2015, 15:28 10 years ago
    4.01? you mean 4.1? If it's 4.1, then it should rotate from the center.
    pos = obj.ObjectSprite.SpriteSprite:getPosition()
    size = obj.ObjectSprite.SpriteSprite:getSize()
    obj.RotationCenter = { x = pos.x + (size.x / 2), y = pos.y + (size.y / 2) }
    

    ... these lines I wrote get the size & position of the sprite belonging to the specified object. These were then used to automatically calculate the center position of each sprite.

    It won't rotate again because it's setting the absolute rotation value, it doesn't add or subtract the value.

    The script got complicated because I was basing the correct image on the returned rotation values of each ring.

    You could simplify this & just use conditions & multiple images instead of actually rotating the image.

    P.S: Sorry for not annotating the code, but it got late & I was getting tired of writing the script. Also the rotation field is confusing because it is based on a radian value, i.e: p * 2 = 180º, instead of just typing 180, hence we needed to convert our degree value into radian & then to check the degree value in the check puzzle function we needed to convert the radian value into degrees & round off the value by removing any decimal values from it. As I said, it got complicated pretty fast & this was only a simple puzzle.

    Imperator

    7278 Posts

  • #8, by unrealTuesday, 03. February 2015, 16:02 10 years ago
    I was on v4.0.1 (my bad), so I've installed the v4.1 and checked the project but sadly same thing happen. I've made a recording to show you (I don't know what's going on).

    Bug CyclePuzzle

    Newbie

    66 Posts

  • #9, by afrlmeTuesday, 03. February 2015, 16:14 10 years ago
    Hmm could be a mac bug. Working correctly on my windows 8.1 laptop. Try adding a longer pause to the at begin of scene action before the execute a script action part.

    P.S: I'm not actually on 4.1 public. I'm using a team build (1179), so I have additional features & bug fixes. I know the current public build is very buggy in regards to mac. Do you have a windows machine or VM for your mac so you can see if it works correctly if you run it on windows?

    Imperator

    7278 Posts

  • #10, by unrealTuesday, 03. February 2015, 16:19 10 years ago
    same thing :S

    Newbie

    66 Posts

  • #11, by afrlmeTuesday, 03. February 2015, 16:43 10 years ago
    Probably a mac bug then. Uploading a screen recording of it working on my windows laptop. I'll edit this post with the link in a few minutes or so.

    https://www.dropbox.com/s/56npma5r1bt21sj/cycle_puzzle_scree... (not sure what happened to the quality) It's supposed to be 1080p @ highest quality settings. Looked crystal clear in VLC media player. Guess dropbox compresses the video to load faster or something. Oh well.

    Imperator

    7278 Posts