randomly's Recent Forum Activity

  • Rewriting what R0J0hound said:

    In your project, you have two parameters:

    • Sound per X degrees "Every X degrees, I want the sound to be played"
    • Rotation speed "Every second, my object should rotate Y degrees"

    So far, so easy.

    Now you create a condition:

    Every Z seconds

    Under that condition, put your Play audio action.

    Now replace Z in your condition by this combination of expressions:

    Z = X/Y

    or

    Z = Sound per X degrees / Rotation Speed

    Example:

    • You want your sound to be played every 10 degrees that the object rotates
    • Your object rotates with the "Rotate" behavior

    Use this for the "Every Z seconds" condition:

    Every "10 / Object.Rotate.Speed" seconds

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Even though there is no sound at all in the game link, I can tell you why it might not work:

    The game you are creating has rotation speeds of 1000+ degrees per second.

    One frame is usually rendered at 1/60 of a second.

    1000/60 is ~17 degrees per second.

    This means that during one frame, the audio would have been played three times already.

    (And this is only for 1000 degrees per second, imagine it being 3000)

    Like this, the sound would play each frame.

    Since the sounds won't stop after one second, they'll overlap and cause weird noises.

    You will have to step up with the 5 degrees to something like 20 or even more.

  • If I understand you correctly and my brain actually works, you don't need Shadow Collision if you have Line of Sight and the shadows move with the enemies.

    Since the calculation of line of sight and shadows work almost the same (covering the area between the lines that go from the enemy to an object's left and right edge), line of sight will have the same triggers as a shadow collision.

    Of course, this only applies if your movable light sources are all attached to enemies.

    It is different, if there are moving light sources that aren't attached to enemies.

    But in your description, it sounds like the first case.

  • Here you go.

    (I just used cjbruce 's code, nothing fancy)

    Btw, in case you didn't know, the % in divisions is the so called modulo operator.

    In returns the rest of a division.

    An example: 5 modulo 2 (5%2) would return 1, since you can put the 2 two times in the four, but you'll have one rest.

    12 % 5 = 2,

    66 % 10 = 6

    and so on.

    This is especially useful here, but generally useful, if you want to see whether a number is dividable by another number.

  • Found this to be an interesting challenge.

    It's just a basic version and it might contain bugs, but it mostly works as intended.

    The actual challenge was the win-detection algorithm.

    Here is the download to the .capx.

    It is by no means perfect, there are many ways to make the win-detection algorithms faster and more effective.

    Two things that I thought of:

    • The Array search area can be reduced to a 5x5 square with the last inserted coin as the center. There is no possible case where you insert a coin and win with a combination that is outside this area.
    • The check for vertical combinations should not check above the last placed coin since you can't place new coins under already placed ones.

    These features are easily implementable, but I didn't have the time to put them in.

    Hope this helps.

  • Thanks for the answer, this is actually almost what I ended up doing!

    With the only difference that I'm using this address now:

    https://maps.googleapis.com/maps/api/browserlocation/json?browser=chromium&sensor=true

    It seemed more accurate to me.

  • Thanks for explaining your project!

    Sooooo, the way I would do it, is this:

    Since Construct 2 comes with no built-in way to export the content of a Sprite, I'd recommend using this plugin.

    It comes with has two important things:

    • An .imageUrl expression that returns the image
    • The action Load image that works similar to the Load from image URL in a Sprite, thus, accepting what has been returned by the .imageUrl expression

    Now, how do you use this for your project?

    The first steps stay the same.

    When taking a photo, you simply load the Paster object with the image from the photo and so on.

    Now, the important part: Saving all the image boards, plus text.

    I would use an Array for this, where each line represents a board and each column stands for different parts of one board, e.g.

    • picture1, containing the imageUrl of the first image, same for picture2, just for the second pic.
    • firstTxt, containing the subtitle for the first pic
    • ThenTxt, subtitle for last pic
    • timer, containing the initial time

    You see where this is going.

    When creating a board, I would give each important object a value representing its board index.

    This will be useful when saving, since you can then loop through all the boards.

    In the loop, you fill the Array, using the loopindex as the Y index in the Array.

    When the loop is complete, you can export the Array and its contents with the .AsJSON expression.

    I would use LocalStorage to save it.

    If you have any questions, please ask. If I find some free time, I will try to create an example .capx for you.

  • Found this post on the nw.js Github.

    I don't have a clue when it comes to javascript, can anyone make use of this and modify the Geolocation plugin?

  • Use the sine behavior that has a period offset of 0 and use its CyclePosition

    expression.

    You might need to change 90+ to 270- or something equivalent, depending on how your player Sprite is oriented and whether you are rotating clockwise or counter-clockwise.

  • You could also use Wait 0 seconds, should have the same result.

    If you're interested in the reason why this action might be needed in some cases:

    When an object is created, it sometimes needs a frame to "prepare itself".

    During that time, you can set e.g. parameters or coordinates, but the object isn't interactive yet, thus can't be affected by other plugins/behaviors.

    To give an example, the Text object expression Text.TextHeight doesn't return the correct height in the same frame as setting the text.

    This means, when you change the text and put an action underneath that, calling the .TextHeight expression, it will not return the correct number.

    But if you put a Wait dt seconds in between, it will work.

    So, if you have an issue like this again, where an object just doesn't seem to react or an object expression doesn't return what it should, you might wanna wait a frame.

  • I created an example .capx for you.

    Hope this helps.

  • You can

    That highly depends on your app.

    What do you mean by "Picture boards"?

    Are they just Sprites with different content?

    If it's as simple as that, you can create a dictionary and save the Dicitonary as JSON in a LocalStorage key.

    The advantage of LocalStorage is that you can have multiple Save slots, all renamed individually.

    But to really help you, I will need more information from you.

randomly's avatar

randomly

Member since 26 Sep, 2016

Twitter
randomly has 1 followers

Trophy Case

  • 8-Year Club
  • Email Verified

Progress

9/44
How to earn trophies