Best Of

  • Re: Tutorials and Free Stuff from Jamie_C

    Jumping Through Solid Platforms From Below

    This quick tutorial will show you how easy it is to allow your player in a platformer game to jump up through a solid platform from below.

    The tutorial and source file is available at my website as well.

  • Re: what numbers are included in random(1,10)

    1, 2, 3, 4, 5, 6, 7, 8, 9 and 10.

    1 is the lowest possible number, 10 is the highest possible number.

  • Re: How to have a turret track like in tower defence games?


    added to the good advice already given, here a couple of suggestions from me:


    As the number of enemies and turrets grow, the amount of checking needed will grow drastically.

    Some pointers to help with performance:

    Have a table, every enemy is represented by a row, every turret by column. Referenced by a self.ID. Reuse rows/columns as enemies die and new ones get added.

    Update the enemy positions every draw cycle.

    Let the enemies (not the turrets) check their distance to every tower and write these values to the table. This can be done for all towers in one "Change Table Value" behavior with multiple Column Value updates.

    Furthermore, only perform the distance check in one enemy per draw cycle, not all of them. this means that even for 30 enemies on screen, the range targeting is accurate to with in a second, their position info however is always precise.

    This allows for minimal code per cycle, yet quite up to date values.

    With the distance values in the table, each turret can now use a loop (with loops per cycle set to 20 or more) and the very fast TableSearch function to find the closes enemy. This way, even with a large number of enemies, on average, only a relatively small amount of rows will actually need to be processed as you block step through the table.

    Even better, work with a grid based system. Thus reduce your distance values based on the grid value, i.e. instead of an enemy being 236 pixels away, declare it as being 3 grid tiles away. Now, lets say your turret range is 4 grid tiles, you will only need to do a table search for any enemies 1 grid tile away. If any are found you are done, if not repeat for 2 grid tiles away, etc. This way you only loop a maximum times relative to your turret grid tile range, or less.

    Enemy hit detection:

    Be mindfull of how you do the hit detection on the enemies. As soon as enemies bunch up or are shot at at a shallow angle, you will run into a situation where either, the wrong, or multiple enemies get hit by a projectile. So you will have to come up with a way to handle this. Preferably as part of your early design. How you will implement this will depend on the type of special artillery you will include later (area of effect, slow effects, dots, etc.). This will probably be your hardest problem to solve.

    Closest enemies logic:

    Something else to consider early on is exactly how you want your targeting to work, or do you anticipate implementing multiple options.

    The simplest is of course "always fire at the closest enemy".

    Another method is "focused fire" on one enemy until that enemy is out of range. This is the most common and most logical in tower defense games.

    Yet another may be, target the weakest enemy.


    As you can see, you have taken on the challenge of doing one of the hardest genres, from an optimization point of view.

    Since all the above implementations are closely related in how they dictate the coding approach, it is very difficult for anyone to give specific and useful piecemeal advice to this on the forums. :)

  • Re: How to have a turret track like in tower defence games?

    I tried setting up where once the enemy collides with the turret's range, change a game attribute, such as your alert attribute, to 1. Else, change the game attribute to 0. If this game attribute is 1, constrain the enemy's position x and y to two other game attributes. Ugh, hold on.

    Here it is in rule form:
    enemy -
    rule: if enemy collides with actor ''turret range''
    do: change game attribute tracker to 1
    else: change tracker to 0.

    rule: if tracker is 1
    do: constrain position x and y
    else: should there be something here?

    This should handle when the enemy is in range or not. I actually have if x position is less than 125, etc., like you do, but I guess they are actually not needed.

    turret -
    rule: if tracker is 1
    do: shoot
    do: rotate to vector of angle blah blah XD

    Shoudn't this do it?

  • Re: How to have a turret track like in tower defence games?

    @Twayne2 said:
    But how does the turret rotate to the next one in line if the enemy's coordinates are still the leading one? That's my problem. :(
    P.S. How does the system even stay working with all of the self values stacking up? Lol. :smile:

    I know, it is in fact quite confusing in and of itself.

    I have the system set up to where once the enemy leaves the turret's FOV, it's no longer recognized as an "enemy". In the code, the enemy coordinates only apply while inside the FOV of a turret. So when it leaves, it's no longer an enemy, so the turret doesn't track it anymore. Like so:

    Basically, imagine that there's a T-shirt the enemies can wear called the "enemy shirt" which reads "I'm an enemy! Shoot me!"
    What basically happens is, the enemy is walking along, and when it comes into contact with the FOV of a turret, it puts on the shirt, alerting the turret. When it leaves the FOV, it takes the shirt back off and goes on its merry way, and the turret leaves it alone.
    Enemies of course stack up, so multiple enemies could be wearing the shirt at once in the same FOV. When one leaves, the turret automatically targets the next enemy wearing the shirt. Kinda like so:

    Automatically targeting the next actor to which certain attributes apply once another ceases to meet the same qualifications is an automatic function of the constrain attribute in GS. If you say, "lock onto enemy xy", itll find the first enemy xy and target it. When that target is no longer an enemy it'll target the next.

    How does this system stay working? Well, technically the values don't stack up. Every time an enemy leaves the FOV, it trashes its enemy values. Really there are only around four or five enemies in an FOV at a time.

    It's very hard to explain but hopefully that made SOME kind of sense. Explaining things in text form is difficult in general.

  • Re: Collide + Screen shake

    Hi @honeymimi56,

    Firstly I would make a global boolean attribute (e.g. 'game_over')

    Now, set a rule in the player:

    [When] - Actor receives event - overlaps or collides - [with] - actor of type - "enemy"
    Change attribute - game.game_over - [To:] - true
    Timer - After - 2 - [seconds]
           Change Scene - [Go to Scene:] - "Game Over"

    Then, in each actor you want to freeze, include the rule:

    [When] - Attribute - game.game_over - [is] - true
    Change attribute - self.Physics.Motion.Moveable - [To:] - false

    To make the screen shake, I would create an new actor (e.g. 'Screen_Shaker', with visibility set to false) and place it in the Scene.

    Now, double click on the 'Screen_Shaker' actor in the scene window and click the lock to enable editing of scene behaviours.

    Create a rule in this unlocked 'Screen_Shaker' actor:

    When - Attribute - game.game_over - [is] - true
    Timer - Every - 0.01 - [seconds]
          Change attribute - scene.Camera.Rotation - [To:] - random(-10,10)

    I hope that helps!

  • Re: Non Game Apps Built with GS

    Awesome job! Keep it up!

  • Re: Non Game Apps Built with GS

    I designed a kick-boxing training app for a client and I built a student directory app for teachers at the school where I work. I, too, think it's powerful and quick for this sort of app development.

  • Re: Non Game Apps Built with GS

    Very cool, it's nice to see non-game apps made with GS. There have been a few announced in the forums over the years, I'm sure if you did a search you'd turn up a few of them. I'll have to check out the two that are available for iphones, good luck with them!

  • Non Game Apps Built with GS

    Has anyone here published apps built with GS that are not a game? I'm curious because I myself published three non-game apps from GS. My experience working on these apps with GS was wonderful, from scratch to publishing. I'm a musician so these apps are music related. I learned GS from zero through the GS Academy tutorials on this website (big applause to the instructors! @jamie_c @Braydon_SFX @bowlboy, @The_Gamesalad_Guru, The lessons are very easy to follow) and on YouTube, and from asking tons of questions on this forum (and always get a clear answer from the community, like @tatiang who answered every one of them, thank you!).

    For the vocal warm up app building logic, I used @Armelline's music player I bought from the GS marketplace.

    If you have published or are planning to make a non-game app, please reply to this thread, I'd love to know, I'm sure many people are too. I've seen Gamesalad mentioned on some articles about making an app for non-programmers, like this androidauthority article.

    Here are three of mine.

    For warming up the voice - available on Play Store & App Store

    Beginner guitar chord finder - available on Play Store & App Store

    A simple pitch pipe app - only on android


    Side note: Working on these music/audio apps, I feel that it would be super awesome for GS if it had the ability to use expression editor in the play sound/music behavior. But it's okay, working on everything else was easy still.