Lou Bagel's Recent Forum Activity

  • Instead of adding 1 to egg add chicken 'count' to egg

  • So, can characters effect and/or be affected by a background tilemap? Like slow down characters going through mud? Or would I need to make sprites for that?

    You should be able to using:

    [quote:283teqi9]Tilemap conditions

    Compare tile at

    Compare the tile ID at a position in the tilemap.

    https://www.scirra.com/manual/172/tilemap

    Although, that could add in a lot of checks every tick

  • Okay, I think I get your situation. I can't look at your capx now but will try to tomorrow if you are still having problems.

    So I assume from this they are typing in the letters on the keyboard?

    One idea off the top of my head is instead of using a textbox to detect keyboard input and only do anything if it matches.

    Either way, I would probably start by loading the letters into an array.

    Create a variable that starts as false (boolean or 0)

    Loop for array.width

    -if [letter to check] = array(loopindex) set variable to true/1

    If variable = true/1 then update text/allow the letter to be added.

    If you let them type anything in the textbox then you would have to check it after and remove as opposed to allow. But you can do the same in a nested loop

    Loop for textboxt.length

    -Loop for array.width

    --if [letter to check] = array(loopindex) set variable to false and end loop

    Can't look at the capx right now so not sure what you have already and if this helps or not...

  • I agree it is a bit odd you can't have the for loop not execute but as blackhornet puts it is just a limitation to deal with. Construct being a 'no coding required' engine has the goal of making things simpler, but when anything is made simpler you lose flexibility.

    You can do it the way you mentioned, you can do it the way I mentioned, you could do x = array.width; while x > 0 spawn & x-- Or while array.width > 0 spawn & remove item from array. All the loops do the same thing just with different formatting to make it simpler in different situations.

  • The problem isn't about the negative index itself, but the behavior of the loop itself. By using end = -1, what I expect is that the loop shouldn't run at all.

    This is what I was doing:

    > for "spawn" from 0 to array.width-1 {
    	create enemy...
    }
    [/code:3rq61buy]
    So if the array size (width) is 2, I will get loop: from 0 to (2-1) ==> result: new enemy.IID 0 & 1.
    If the array size is 1, I will get loop: from 0 to (1-1) ==> result: new enemy.IID 0.
    If the array size is 0, I will get loop: from 0 to (0-1) ==> result: new enemy.IID 0 & -1???
    
    Using multiple by -1 will make: from 0 to 1 ==> result: new enemy.IID 0 & 1, which is still wrong as I got empty array.
    
    In short, the for-loop is more like do-while.
    

    So you are saying that the problem is that it will execute with a negative value?

    That sounds like what it should do because if the ending index is lower than the starting it should change to for(i = 0; i > array_width; i--)

    If your only issue is the loop executing when empty why don't you just but a pre-condition as array.width > 0 ?

  • Setting the scale to integer/browser.DevicePixelRatio did restore pixel-perfect under crop setting.

    Ashley despite the warning it still seems as the crop setting would be the easiest way to create a 'integer scale outer' so to speak. As now that I have it with pixel-perfect all I need to do is check the screen size and set to desired integer, which right now I'm only seeing that 1 and 2 will be needed

  • I wasn't aware of this and am also interested in hearing the answers to your questions, but if you need a simple work-around you can always multiple by -1 or take totalindex-loopindex to count backwards

  • Did the image origin move?

    I believe origins can't be between pixels (only at integer values) so wouldn't affect this

  • Thanks

    but how do I implement that ?

    Sorry, I didn't look at your capx so not sure what you are doing exactly, but here's an example to explain what I mean and you can apply it to your situation.

    Let's say you want to create 10 sprites starting at coordinates 100, 100 and every 25px moving straight right (increasing X):

    ON whatever triggers

    -For startindex=0 endindex=9

    --create sprite at location x = 100 + 25*loopindex; y = 100

    This will create 10 sprites at x coordinates 100, 125, 150, 175, 200...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok,i got this but another problem appeared

    Can i compare a letter in textbox.text ?

    It would be the same just replace "ball" with the letter ("r")—not sure I understand what the problem is...

  • For Loop

    base + increment*loopindex

  • ...time corrodes them away...

    I'm pretty sure that depends on the quality of the CD. Yes, the CDs I burned in the 90s don't hold up anymore but the CDs I purchased in the 90s still play fine as long as they aren't scratched.

Lou Bagel's avatar

Lou Bagel

Member since 7 Sep, 2015

Twitter
Lou Bagel has 3 followers

Connect with Lou Bagel

Trophy Case

  • 9-Year Club
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Popular Game One of your games has over 1,000 players
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

16/44
How to earn trophies