R0J0hound's Recent Forum Activity

  • How are you placing the cubes?

    If you are placing the cubes from isometric coordinates (ix,iy,iz) the diagonal would just be iy.

    As an example here is the math to project an isometric position (ix,iy,iz) to the screen (x,y):

    X=ix-iy

    Y=(ix+iy)/2-iz

    If instead you only have the xy positions of the cubes you can reverse the formulas above to get the iso position. But the iz value can be anything per cube.

    ix=y+x/2+iz

    iy=Y-x/2+iz

    Possibly you can look at the zorder and relative position of overlapping cubes to calculate the iso position too. But you’ll often have ambiguous solutions. For example if there isn’t a cube at the center intersection then it out guess four iy layers instead of three.

  • Typo on my part. It should be mid(a,loopindex,1). I wrote i instead of 1

  • One way could be to find individual letters in the first string in the second. Anytime a letter is found you’d remove that letter from the second. It would mess up the second string so you’d want to copy it first. Should be pretty doable in a function:

    function findMatches(a, b)
    -- var match=""
    -- var letter=""
    -- var i=0
    -- repeat len(a) times
    -- -- set letter to mid(a,loopindex,i)
    -- -- set i to find(b, letter)
    -- -- compare: i>-1
    -- -- -- add letter to match
    -- -- -- set b to left(b,i)&right(b, len(b)-1-i)
    -- -- -- set return value to match
  • Had another go at it so now the logic is a bit more understandable and fits within 25 events.

    When you click on a tile it does a search for valid moves from that tile to other matching tiles. the path from one tile to another can only bend twice and the path has to go through an empty space first.

    Then when you click on a matching tile it destroys the tiles and draws the path.

    If you want to see the pathfinding in action make the marker sprite initially visible in the editor.

    It's trivial to change the number of unique tiles, but just be sure there are enough tiles on the board so there can be pairs.

    dropbox.com/scl/fi/gpd6ss46cm1a7vfb469ev/onet2.capx

  • Is it the same thing?

    That example was after me plating an Onet game just long enough to infer some rules. Best I could tell matches consisted of adjacent tiles or tiles connected with a path with at most two bends. There are probably simpler and more understandable ways to do it.

    I know the common way to make games now a days is to find a tutorial or find/buy a template. But usually you can get pretty far just by making a list of the rules of a game and figuring out how to do each of those.

  • Are you using the latest version of C3 on windows? I’ve had c3p files fail to load in older versions of c3 if they were saved in newer versions. It helpfully points out that the file was saved in a newer version or just gives that error. Even reloading c3 sometimes fixes it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There’s nothing in that file.

    All a ray cast does is check for collision between two points. Quick test works fine.

  • Are you specifying what objects are an obstacle for the Los behavior?

  • Where is the imagepoint? If the origin is one one side and the imagepoint is on the other then casting from self.x, self.y to self.imagepointx(1), self.imagepointy(1) should do it.

    Or if you really want to use sin/cos you could do self.x, self.y to self.x+cos(self.angle), self.y+sin(self.angle)

    I’m only commenting on the math. Other than that the logic seems fine at a glance.

  • Add another condition to the event: green overlaps enemy?

  • Does it rely on a library being loaded first or is that the script entirely?

    Scripts in construct run in “strict mode” which is more restrictive with what you can do in js. Presumably without strict mode assigning a value to an undefined identifier will just create a new variable, but I haven’t tested.

    construct.net/en/make-games/manuals/construct-3/scripting/using-scripting/javascript-construct

    Some random thoughts at least. I don’t mind js but haven’t used it much within construct because it adds an extra layer of complexity sometimes.

  • If you just want to pick the closest enemy then:

    Enemy: pick closest to (player.x, player.y)

    Or if you want to pick all the enemies within a certain distance of the player:

    System: pick by comparison: enemy: distance(enemy.x,enemy.y,player.x,player.y)<100

    I personally wouldn’t want to touch any code that ai generates. Mainly because debugging is hard and time consuming. I find it easier to try to understand what I code as I go so I’m able to fix things as I go. I have no way of verifying how correct, robust or bug free a piece of ai code is without dissecting it which sounds like an annoying waste of time.

R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 157 followers

Connect with R0J0hound