7Soul's Forum Posts

  • You do not have permission to view this post

  • You do not have permission to view this post

  • I'm not really sure it works but, what I meant is you make the collision mask of the platform object only 1 pixel in height

  • This has been an issue for years, but it's one of those they can't fix given how the whole platform behavior works. The easiest workaround is to make the platform collision 1px high as far as I remember

  • Menu > About shows which version you're using, is that what you meant?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Also if you're using Unbounded Scrolling the pathfinder gets weird results because it doesn't considers the area outside the actual layout size to exist

  • You have to use one tilemap object for the floor tiles, and one for the props that go on top of it. It's simpler if you put them on separate layers and turn on the setting where not-selected layers become transparent

  • You should use UID (unique ID) for that. Put all those pick-up-able objects in a family, like "Items", then when the player picks up wood or anything else, you pass the UID of the item to the function, then in the function you do "Items -> Pick by unique ID" to pick the correct item from the family

    Then if you want to check what item it picked, you add a sub event after picking the family object by UID and add a "compare two values" and compare "Wood.pickedCount > 0" or "Meat.pickedCount > 0"

    (I hope I understood your question correctly)

  • what I like to do when I want to select things like that is use a big sprite called Detector, big enough to cover the area you want to check. set it to tileX and tileY, then have a event "Detector is overlapping sp_tile" to pick all the ones around that tile location.

    either make the Detector sprite invisible or remember to move it off screen after checking is done...

    But be careful because this can add a lot of collision checks, and those can pile up and slow down your game

  • Hi 7Soul, sorry i can't get the link to load.

    Oops, should be working now.

    I should also have posted the formula along with the link, which is: (x ^ 0.5) * 10

  • Is this what you have in mind?

    bit.ly/2X8yXoG

    In this example the lower bound is 0 and the upper is 10. 0.5 is how steep the curve is, a lower value makes it more extreme.

  • You can limit values with the expressions min, max and clamp. And you can use those when setting the camera positions, for example setting the camera X to clamp(Player.X, 0, 1000) will not allow it to go below 0 or above 1000 in the X axis while following the player

    You can then create "camera areas" using an invisible TiledBackground or 9Patch object, and "while player overlapping camera area" you can set the "camera area" X as the limit for the left side, and X + Width as the limits for the right side

    Also you want to take into account how wide the screen is, so the camera stays in the center, so you add half the Viewport Width to that calculation

    Set Camera X to clamp(Player.X, CameraArea.X + ViewportWidth / 2, CameraArea.X + CameraArea.Width - ViewportWidth / 2)

    And then same for the Y axis

  • EDIT: I think I found a way to do this... ignore this post for now

    Ok I got around this by passing all the variables as a single string separated by commas into the function. Then in the JS script I do a split() and this is working just fine

    The JS script looks like this:

    function Compare(a,attacker,target) {
    	var stat = {armor:0, crit:1, critDmg:2, dmg:3, mhp:4, hp:5, shotcount:6};
    	
    	var aArmor = attacker.split(",")[stat.armor];
    	var aCrit = attacker.split(",")[stat.crit];
    	var aCritDmg = attacker.split(",")[stat.critDmg];
    	var aDmg = attacker.split(",")[stat.dmg];
    	var aMHp = attacker.split(",")[stat.mhp];
    	var aHp = attacker.split(",")[stat.hp];
    	var aShotCount = attacker.split(",")[stat.shotcount];
    	
    	var tArmor = target.split(",")[stat.armor];
    	var tCrit = target.split(",")[stat.crit];
    	var tCritDmg = target.split(",")[stat.critDmg];
    	var tDmg = target.split(",")[stat.dmg];
    	var tMHp = target.split(",")[stat.mhp];
    	var tHp = target.split(",")[stat.hp];
    	var tShotCount = target.split(",")[stat.shotcount];
    
    	return eval(a);
    }[/code:o1ddw9dm]
    
    
    

    create js variables in your script, set their values to Construct variables values (use aliases) and then operate with those js variables.

    That's what I thought I had to do, but I don't think I understand how to do that properly

    I don't think I can send you the file because it's a huge mess, but what I'm trying to do is very simple.

    In my game there are many items, and they can have conditions to activate (like based on a random chance, or when the enemy has a certain % hp, or based on the enemy armor, etc) and I want to write this condition in an external file, as a string, so I don't need to add an event for each and every item to do the comparison.

    In this engine, both enemies and the player are in the same family, and they use a dictionary to store their stats. Every time someone attacks someone else, a "calculate damage" function is run, and it sets local variables to do all the calculations regarding the attacker and the target

    So if I have an item that increases the damage only if the target's health is below 50%, i'd add a condition later in this function that would compare if tHP is lower than 50%. But I plan on having around 80 items, so that's a lot of hard-coded conditions

    So I made it so all the items have their conditions written somewhere else, in a text file. So the condition would read "tHp < 0.5" and I'd use the JS plugin to eval that expression. But like I said, I can't pass the variable as a parameter because the expression could be anything.

    So if I got this right, I could Alias the variables right after I set them (in the image above) and then the JS would be able to use the variable, right?

  • Amazing plugin! I ran into a little problem I was hoping you could help me with:

    I'm trying to use this script to eval a string. This string could contain any number of global variables and even call functions

    A test string, called var1 is this: "shotCount % 3 == 0"

    The event is JS Call Function "Compare" with parameter 0 being var1

    The .js file has this:

    function Compare(a) {
    	return eval(a);
    }[/code:3ij8w5km]
    
    But it doesn't work, it says "shotCount is not defined" in the log. If I change var1 to something like "2+2" it evals correctly.
    I don't want to pass the global variable because I need this to be flexible and allow multiples and any variable. Do I need to somehow put the variables into the scope of the JS plugin?
  • This is the intended behavior