Spare Code ? Dump It here.

1171820222327

Comments

  • jackhammer1000jackhammer1000 Member Posts: 7
    edited August 2014

    Hello. im new around here and i started to create a simple game (untill i level up my skills) and found myself facing an issue. i needed to create a health bar that will be shrinking from one side only i.e. aligned to the left. i found some solutions and videos on this matter, however, they all refer to a static health bar. it didnt work for me because my health bar was dinamically moving along with its corresponding enemy. and since this health bar was also spawn dinamically i couldnt go into its backstage and do changes to it.
    i dont know if this method is the best but since it took me quite some time to figure out the formula i thought mybe i'll share it here.

    so first i created a table with 2 columns (health, positionX,)
    next, i set a timer on the enemy actor "every 0 sec" change table value "table1.positionX" to self.position.x (i.e. report to the table its current X position)

    in the health bar actor i used a constrain "self.size.width" to "table1.health"
    and another constrain "self.position.x" to a formula that goes like this:

    table1.positionX-(((table1.positionX-table1.health/2)+100/2)-table1.positionX)

    a little explanation (think of the formula as A-(((B-C/2)+100/2)-D):

    A is table1.positionX (constantly changing by the enemy actor).

    B-C is the same current position subtracted by half of the current health.

    100 is the initial health for this enemy (so if you have a different value for your enemy you need to change this or you can use a global attribute).

    and D is again the positionX from the table.

    this will result in a moving health bar (according to its corresponding enemy actor) by aligning it to the center of the enemy minus 5 pixeles for each hit, half the damage each hit causes, and will shrink from the right.
    i hope i didnt make it too complicated.

    good day.

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881

    @jackhammer1000‌ -- great solution! Thanks for sharing with the community!

  • jackhammer1000jackhammer1000 Member Posts: 7

    thanks. it took me quite some time to figure it out...

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    Here's a nice simple tutorial that shows you how to sort a table from high to low. This tutorial/demo would be helpful if you were creating a local leaderboard, for example.

  • SnapFireStudiosSnapFireStudios Member Posts: 1,603
    edited August 2014

    Hey guys, how about we start a Google Drive Spreadsheet with all of these listed? Columns could be Contributor, Name, Description, and Download link.

    -- Thomas

  • SnapFireStudiosSnapFireStudios Member Posts: 1,603

    Also - That's really incredible @StormyStudio - It's something that I never really thought was possible in GS. Keep up the great work!

    -- Thomas

  • PhilipCCPhilipCC Encounter Bay, South AustraliaMember Posts: 1,390

    @SnapFireStudios said:
    Hey guys, how about we start a Google Drive Spreadsheet with all of these listed? Columns could be Contributor, Name, Description, and Download link.

    Sounds like a great idea. I mostly read the Forum using my iPad so when I often find gems in old threads and don't write down exactly where where they are, or download them immediately when I get on my iMac, I sometimes spend ages trying to find them again to learn something or use in a project.

    This thread alone for example, is already 20 pages long and will keep growing. If you recall there is something in particular here that you'd like try out it can take a long time to find it again.

  • SnapFireStudiosSnapFireStudios Member Posts: 1,603

    The question is - can you make an add-only sheet? I don't believe so. We wouldn't want someone coming in and deleting all of them, and one person managing a read-only one would be difficult.

    Any ideas?

    -- Thomas

  • colandercolander Member Posts: 1,610

    A library looked after by the mods would be good but a database would have to be created which means a lot of work for someone so probably not practical.

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881

    @StormyStudio said:
    Full A* Pathfinding Algorithm and Spawnable (custom sized) Isometric Grid.

    Holy Cow! Mr. Stormy -- how did I miss this?!?! Thanks so much for sharing all the work you put into this!

  • ArmellineArmelline Member, PRO Posts: 5,397
    edited September 2014

    @SnapFireStudios said:
    Hey guys, how about we start a Google Drive Spreadsheet with all of these listed? Columns could be Contributor, Name, Description, and Download link.

    Excellent idea! Here's the first four pages:

    https://docs.google.com/spreadsheets/d/1pTNnPV6VS0fAMuSei0Hf3e6S2p7NZF3gViGk0m72sYU/edit?usp=sharing

    I've included:

    • The contributor
    • File name
    • Brief description (minor editing done at times)
    • The original download link, though some are no longer available
    • A mirror on the Google Drive associated with this account
    • A link to the specific post in this thread for that item

    When someone linked to their own site with multiple downloads, I've not mirrored them - I'll contact the individuals for permission once the list is up-to-date. If a demo was hosted on a third-party site, or attached to a post in this thread, I've mirrored it. Please let me know if you do not wish your code mirrored and/or listed!

    Hopefully I've actually got it set to read-only and I'm not going to lose the last hour's work :D

    It'll take a fair bit of time to get through all 20 pages, but I'll chug away at it.

    I'm also going to PM the login details for the account to Socks, as the thread-starter and motivator.

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    @Armelline said:
    Excellent idea! Here's the first three pages..

    Very nice!

  • colandercolander Member Posts: 1,610

    @Armelline Thanks that's great a well deserved Awesome.

  • PhilipCCPhilipCC Encounter Bay, South AustraliaMember Posts: 1,390

    @Armelline Thanks, this is great! Yes, it is set to Read Only.

  • StormyStudioStormyStudio United KingdomMember Posts: 3,989

    Nicely done @Armelline‌

    And thanks to the thanks from peeps for sharing my A* pathfinding.

  • ArmellineArmelline Member, PRO Posts: 5,397
    edited September 2014

    Pages 1-6 in the spreadsheet so far!

    For more info see my previous post: http://forums.gamesalad.com/discussion/comment/493089/#Comment_493089

    For the spreadsheet, visit:
    https://docs.google.com/spreadsheets/d/1pTNnPV6VS0fAMuSei0Hf3e6S2p7NZF3gViGk0m72sYU/edit?usp=sharing

    And damn Socks, that shadow demo. :o

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    Wow, @Armelline‌ - Great stuff! That must be a tedious job! Thanks for taking the time to do that!

    Here's one I think may be appropriate to add - not because of the complexity, but because of how many people have messaged me via PM or through email asking how they would do this.

    Detect how many times a specific variable appears in a table. Want to know how many times the number 9 appears in a table? This simple demo file will show you how. Works for any number, text, etc.

  • SnapFireStudiosSnapFireStudios Member Posts: 1,603

    Awesome @Armelline - Exactly what I was hoping for :)

    -- Thomas

  • HopscotchHopscotch Member, PRO Posts: 2,782

    Fantastic and appreciated effort @Armelline‌ ! Thank you!

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    edited September 2014

    Letter/Gesture Recognition

    Here is the letter recognition example that I demonstrated at the July meetup. It can be used to... well... recognize when letters or gestures are drawn on the screen.

    You can train it to recognize any letter(s)/gesture(s) you want by modifying the letter recognition table. You simply enter the number sequence that represents the letter/gesture.

    http://www.mediafire.com/download/dr99baoefukc1dr/letterRecognitionDemo.zip

  • natzuurnatzuur Member Posts: 304

    Some amazing stuff going on in this thread since i last checked in!

    Thanks for setting up that doc @Armelline

  • PhilipCCPhilipCC Encounter Bay, South AustraliaMember Posts: 1,390

    @RThurman‌ I was floored and completely enthralled by you demo at the Meet-Up.

    Thanks for allowing us to download and play with it.

    Maybe you better mention here the caveat on using the example alphabet (that you said was copyright) on the right of the demo here?

  • SocksSocks London, UK.Member Posts: 12,822

    @RThurman said:
    Letter/Gesture Recognition

    :o

    Wow !

  • quantumsheepquantumsheep Member Posts: 8,188

    I love this thread :D

  • SkyDogSkyDog Fairfax, VirginiaMember Posts: 20

    great job! well done

  • SkyDogSkyDog Fairfax, VirginiaMember Posts: 20

    great job! well done

  • pHghostpHghost London, UKMember Posts: 2,342

    Some simple code. Want to use Stretch but have circles or perfect squares in your project?

    This here code should solve the issue.

    It solves it by effectively applying a reverse stretch. It's ideal for things like HUD or so. Just drop the code into the actor you want to anti-stretch.

    This effectively changes the actor's vertical size, so it will expand in relation to other objects and as such is not ideal in every single situation and game.

    Enjoy!

  • LumpAppsLumpApps Member Posts: 2,881

    Time for me to do some community love. Here is a proto for making a game with trams or whatever following a track you build on the fly.

  • PhilipCCPhilipCC Encounter Bay, South AustraliaMember Posts: 1,390

    @LumpApps‌ Oh wow! This is really clever…it inspires all kinds of things. Thanks. :D

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    @LumpApps said:
    Time for me to do some community love. Here is a proto for making a game with trams or whatever following a track you build on the fly.

    Wow that's awesome! Thanks for sharing!

Sign In or Register to comment.