Minor's Forum Posts

  • Here's an example of getting the tile information around the player in a platform game.

    [attachment=0:1odsqu5f][/attachment:1odsqu5f]

  • Here's a quick example.

    [attachment=0:ls7tsj89][/attachment:ls7tsj89]

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The "regenerate obstacle map" action is under the object that has the "pathfinding behaviour". So if your object that has "pathfinding behaviour" is "enemy" double click it and scroll down until you find the "pathfinding" sub-heading.

    [attachment=0:3lcpcrdj][/attachment:3lcpcrdj]

    You'll probably need to put this action in the event for adding a new turret to the map.

  • I'm guessing you haven't recalculated the path finding map (regenerate obstacle map) after a new turret has been spawned/placed.

  • why you need to compare mid(pattern, loopindex("x"), 1) with "1" ?

    To find out if I need to create a coin or not. A 0 in the string is air/nothing while a 1 is a coin.

    If you are asking why I'm checking for

    "1"

    rather than

    1

    then that's because the information in the "pattern" variable is stored as a "string/text" and not an integer/number. So if you checked for 1 it would never be true.

    You could of course change it to int(mid(pattern, loopindex("x"), 1)) with 1 and covert the string to an integer.

  • Well done Minor !

    I did not expect someone to make an example...without using arrays

    Why thank you.

    Arrays would be much easier. Some people have trouble with them, although string manipulation is much more of a pain to work with.

    I carried on playing and created a "Text to Coin" converter thingy.

    Need a better font and could also make it so I can save the coin pattern/text as JSON to load into an array.

  • While I would say an array is the easiest way I have thrown this together showing how you could do it with a string of 1's & 0'S.

    HTML5 Demo

    Press "Space" to make coins appear best wait until the last coins have gone off the screen before pressing "space" again.

    [attachment=0:313i1cih][/attachment:313i1cih]

  • Set a variable to AnimationFrameCount-AnimationFrame?

    AnimationFrameCount is the number of frames in the animation. AnimationFrame is the current animation frame.

  • Why not have a blank square in the spritefont and add a "space" in the string in character set box on the left.

    No need to find and replace anything.

    [attachment=0:mpllxl4o][/attachment:mpllxl4o]

    **EDIT

    My spritefont has A-Z then a blank square then 0-9. My character set is ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789

  • You could do it with a tiled background.

    [attachment=0:1tm3mg5f][/attachment:1tm3mg5f]

  • Why not just set the platform X & Y vectors to 0.

    Gravity will take over and your character will just fall to the ground. No need for a variable or timers. Or am I missing something?

  • Wow, that's really neat! I was looking around for something like this recently; my space based shooter would look great with an animated nebula in the background...especially since the working title is 'Nebular Drift'

    Any way to get it moving?

    I have no idea

    If you are mathematically minded/genius you could implement

    Density Wave Theory

    .

    Or you could try to cheat with extra canvases. Create a random number and plot the point/star on a different canvas depending on this number and then rotate the canvases at slightly different speeds. Not sure how it would look but would probably be better than rotating the 1 canvas.

    **EDIT

    Scratch that.

    Link to gif -

    (7mb & recorded at 10fps)

    Multiple canvases destroys the galaxy.

  • So after playing around with this for a few hours I think I've gone as far as I can due to my math & lack of real programming language knowledge.

    Here is the code I think I sort of implemented or not. More likely not.

        public Vector3[] GenerateArm(int numOfStars, int numOfArms, float rotation)
        {
            Vector3[] result = new Vector3[numOfStars];
            Random r = new Random();
    
            float fArmAngle = (float)((360 / numOfArms) % 360);
            float fAngularSpread = 180 / (numOfArms * 2);
    
            for (int i = 0; i < numOfStars; i++)
            {
    
                float fR = (float)r.NextDouble() * 64.0f;
                float fQ = ((float)r.NextDouble() * fAngularSpread) * 1;
                float fK = 1;
    
                float fA = ((float)r.NextDouble() % numOfArms) * fArmAngle;
    
                float fX = fR * (float)Math.Cos((MathHelper.DegreesToRadians(fA + fR * fK + fQ)));
                float fY = fR * (float)Math.Sin((MathHelper.DegreesToRadians(fA + fR * fK + fQ)));
    
                float resultX = (float)(fX * Math.Cos(rotation) - fY * Math.Sin(rotation));
                float resultY = (float)(fY * Math.Cos(rotation) - fX * Math.Sin(rotation));
    
                result[i] = new Vector3(resultX, resultY, 1.0f);
            }
    
            return result;[/code:1i0h2gyi]
    
    I understand some but not all.  I've disabled my implementation of the lines:
    
    float fArmAngle = (float)((360 / numOfArms) % 360);
    float fAngularSpread = 180 / (numOfArms * 2);
    
    When using these lines there isn't a spiral just a nice circle.  Also the code converts degrees to radians so maybe that's where my version trips up.
    
    This is what generates using my sort of hack of the code.  Which doesn't look too bad but when changing some values it either destroys the spiral or makes a nice circle.
    
    [img="https://dl.dropboxusercontent.com/u/1646976/Game%20Media/Misc/galaxy.png"]
    
    [url=https://dl.dropboxusercontent.com/u/1646976/ConstructTutorials/Construct2/Not%20Very%20Good%20Galaxy%20Gen%20V1/index.html]HTML5 Demo[/url]
    
    And the capx.  You'll need the [url=https://www.scirra.com/forum/plugin-canvas_t64239?&hilit=canvas][h2]Canvas Plugin[/h2][/url] to have a play around.
    
    [attachment=0:1i0h2gyi][/attachment:1i0h2gyi]
    I wasn't really planning to use it for anything [i][h2](or am I?)[/h2][/i] other than a learning exercise and I love stuff like this.
    
    If anyone does have a play and improves it just post it here and if possible explain my stupidity in the implementation of code or maths.
  • Finished commenting the capx for maze generation and the solver.

    HTML5 Demo

    Controls:

      R - Generates a new maze Left click - Place start point Right click - Place end point Spacebar - Solve Maze C - Clear solved path so you can find on new one on the same maze

    I've tried my best to explain how the maze is generated but I'm not great at it. I hope the explanation makes some sense or you can at least work it out from the events.

    [attachment=0:1tfelxa9][/attachment:1tfelxa9]

  • wow, fantastic Minor ! i really admire what your doing there and did with your low res dungeon project! did you ever consider writing a post where you explain how the maze is generated and the different wall sprites are set? That would be absolutely fantastic and would drive me to continue my abandonend dungeon project

    fldr

    Thank you. I can write a tutorial on the maze generation if it would be of some use. The tiling is bitwise tiling and I think there are a couple of tutorials on that already but I can also do that too. I'll also comment the capx and post it for anyone to have a play around with.

    Give me a couple of days for the capx and a bit longer for an explanation.

    shinkan

    Minor Indeed. this is really fantastic!

    Thank you sir