BillyShears's Forum Posts

  • -Player is a square

    -I have platform behavior and a solid object floor.

    -Spacebar simulates jump

    -When player not on floor I rotate

    When I press spacebar the square jumps and rotates how I want but when it lands back on the floor or onto another square it doesn't flatten out. What am I missing here? Thanks for any advice!

  • I tried a few things that worked nicely. Thank You!

    Ultimately since my game doesn't scroll constantly I had to go back to my method. I fixed it by doing some math. I had to take into account that I only shift the tiled bg X after the move is over. So I had to expand the tileBg size to double the screen plus the character's move distance and make sure it is was an even multiple of the sprite size (to keep from jerky effect) . Sounds crazy but it works now some I'm going with it ;)

  • I have a tiled background that is similar to that of an endless runner but doesn't move all the time. I only move it on a certain condition.

    First issue: Since the background does not move all of the time AND I need it to get to the new X in a set amount of time, I am currently using tween to change the tiled background X to self.x - movedistance when a condition is met. This seems to work fine, just wanted to check if I should do this a better way.

    Main issue: I am looking for a known formula to shift the X value of my tiled background to make it seamless and endless. I'm currently using tileBG.X + tileBG.Width/2. This works for some of the tiled backgrounds but one of them will have a gap before it shifts and fills back in.

    For example,

    -the screen width is 1080

    -I have an 80 pixel sprite tiled to 2160 width, this one works

    -Another 128 pixel sprite tiled to 2176

    -The background movedistance is -400 (NOTE: I all worked fine when the movedistance was -80)

    -I currently wait until the tween is done to check if a shift is needed, this causes the gap

    -If I do it immediately there is no gap but my tween is still playing and sometimes its noticeable when it shifts X.

    So, my main goal is to move the tiledbackground endless and seamless (no gaps) only when a condition is met and it must arrive at new x in set amount of seconds.

    Thanks for any suggestions!

  • Thanks, will try this out shortly.

    For the movement, should I use bullet behavior?

  • BillyShears

    I managed to compensate for the x/y drift, so z-elevation will scale from the object's origin regardless of position in the viewport - updated in the demo linked above.

    Thanks, I will be trying this as well.

  • First off, I do already have this working, but starting to think I did it the long way. I'm currently tracking the start and end coordinates of a swipe, compare it to the coordinates of my grid rows and determine what direction the swipe is.

    After some looking around at behaviors, I noticed tile movement and was wondering if I should have been using that all along or if there is even another easier way to do this.

    In my project, I have a four by four tile grid and when I touch a tile piece, and swipe (up, down, left, right only, not 8 direction) I want the touched tile to move onto the next tile in that direction.

    What is the cleanest, least amount of conditions, easiest way to do this?

    Thanks!

  • Thanks for the recommendations, I was able to get this working.

  • More specifically, I want the score to pop out quickly when it changes then back to normal size. I’ve tried tween size but found it just changes the text object’s size and not the font, which makes sense. Thanks for any suggestions.

  • Well.. you can set the variable isfinished = true in the main event..

    because doesn't matter if the value is odd or even, you will always set true to the boolean..

    So, if the main event is true, it always will be isfinished = true.. does it matter if sets before or after?

    Even if you have another event comparing if isfinished = true, as I undestand, it will always finish the main event and subevents before trigger other main event.

    Edit: or you can just have a last blank sub event, parent of the main event with action set isfinished = true.. it will always run but last

    Thank you, I will try both of these.

  • Thank you, I will set my example up this way.

  • Does an action in event run after sub event? If not, how do I run action after sub event?

    For example:

    1) Event - checks if value is greater than 0

    2) If value is greater than 0, do sub event

    3) Sub Event - checks if value is odd, if odd do something

    4) Sub Event - Else value is even, if even do something

    5) After SubEvent set boolean isFinished = true

    I'm wondering if I have to set isFinished at the end of each path or if there is an easier place to set it just once when everything is complete.

    Thanks!

  • Unless you are performing this on every tick, with your array size I don't think there will be any difference in performance even if you do 1000 passes.

    If you need to scan every row and every cell for a certain value and repeat this until this value is no longer there, here is how you can do it:

    Thank you very much, it took me about 1 minute to get it working. I added the extra condition to the while loop i already had and that did the trick. (I even added the loopindex safety check).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • First of all, with such a tiny array, you could probably get away with doing thousands of full scans in a single tick without noticing any sort of slowdown.

    That said, if you still want to optimize it in a way to reduce redundant checks to a minimum, we need to know a bit more about what you are actually trying to do.

    In particular, could you perhaps elaborate on this sentence : "If I find the value, I would remove it from that cell but possibly add the value elsewhere in the array".

    Is the value shifting conditionnal ? (if so, what is this condition ?)

    Where do you move the value ? (same row, column, anywhere in the array)

    Do you "set" another cell, or do you add a cell value to another ?

    Thanks for your feedback, yes you basically explained how it works, I always remove it once found then conditionally add to adjacent cells, i did get it working now (relief!)

  • I am trying to iterate through an array and currently have nested for loops using the loop index to accomplish this. (Is this even best practice?) This works great for one pass through the array.

    However, I need to find the optimal way to iterate through the array multiple times until I process a certain value found in the cells, and keep searching until the value is no longer found. If I find the value, I would remove it from that cell but possibly add the value elsewhere in the array, thus the need to search/iterate through again.

    Here are my ideas on how to do this ...

    A) If possible, make a loop that uses a counter variable as the loopindex that I increase or decrease accordingly, this way I could check the cells in one row for the value I'm looking for, if value was found counter does not increase and I process the row again. If value is not found, then all clear and I increase the counter by 1 thus moving to the next row. This choice would let me process only one row at a time before having to repeat the search.

    B) Use my existing nested for loop inside a while loop, and just keep running the for loop with regular loop index until the value is no longer found in the array. This seems simpler to set up but would iterate through the whole array before having to start the search over again.

    I know either choice will most likely be a dog on performance but hoping to take less evil. The array is 8 x 10 max and I'll probably wind up repeating the array search anywhere from 0-20 times (if that helps when considering performance cost).

    My actual questions:

    1) Which choice is best (performance and ease to build)? Is there a better way I'm not seeing?

    2) If choice A is even possible and I use counter variable as loop index, which type of loop do I choose specifically and how do I set that loop to use my counter variable?

    3) If choice B the nested loop inside a while loop, how do I actually stop the while loop? I've found stop loop condition while researching but not sure where to add that in relation to the while loop.

    Thank You for any feedback or assistance!

  • BillyShears You need to download the addon manually from that link I gave you, then install it in Addon Manager. Then restart Construct and try to open the project.

    https://www.construct.net/en/make-games/manuals/construct-3/tips-and-guides/installing-third-party-addons

    Took a little break, but I did get my menu working. Thanks for all the help !