oosyrag's Recent Forum Activity

  • Both the date/time and the newgrounds plugins are great, but have a few prerequisites. I will write about it as well, but my goal is to keep things as basic as possible, hopefully working "out of the box" in terms of plugins. I want to go over each available method and the advantages/disadvantages of each. Here's what I have so far.

    ExecJS("Date()")

    • Simplest solution without plugin
    • Works on system time, gameable
    • Need to convert to UNIX Time, complicated

    EDIT - Found out ExecJS("Date.now()") gives the timestamp without needing to convert.

    Rex_Date plugin

    • Simplest solution with plugin
    • System time
    • Needs plugin

    Geocache timestamp

    • System time
    • Requires location services - intrusive to user

    Multiplayer Plugin

    • Need to set up own server to request server's timestamp
    • Advanced/complicated

    AJAX request to third party website

    • Simplest online/server solution
    • Relies on availability of third party website
    • May cause unwelcome stress to server
    • Possibly requires authentication/plugin

    NG.io

    • Requires plugin, NG.io account/project
  • For Each Monster    |  Monster Spawn Bullet
    Every 1 Seconds     |  Set Bullet angle towards Player[/code:zdfyh7lc]
  • Many options are explored in this thread:

    There is one more I just found, in that there is a Timestamp expression in the Geolocation object that gives you UNIX Time based on your system time. While your game is running, save this to a variable/localstorage, then on start, you can get the UNIX Time and compare what the difference is from your saved value to make adjustments accordingly. Haven't experimented with it yet though, it seems like there may be some delay issues when requesting geolocation. The methods in the linked post should be more certain.

  • You can also do it with a loop. Here's an example to get the low and high x:

    global number low=0

    global number high=0

    every tick

    --- set low to infinity

    --- set high to -infinity

    for each sprite

    --- set low to min(sprite.x, low)

    --- set high to max(sprite.x, high)

    That is exactly what I was looking for, thanks R0J0. I was having trouble wrapping my head around how to keep only the lowest or highest value in a loop. I had tried comparing each value to the one before it, but that would result in issues where the order the values were checked would matter.

  • I can make an example later, don't have C2 in front of me.

    But basically just think of an array as a spreadsheet, pretty simple. You can have one column for each level, and 3 rows which represent each star. In each cell, a 0 would represent not collected, and a 1 would be collected.

    When you collect a star, you would set that star's position in the array to 1. This way, if it was 0 before, it would change to 1, and if it was already 1, nothing would change.

    Then run a loop in the array, for each xy, that adds everything in the array. That would give you your collected star count.

    Example to come tomorrow!

  • As long as there is no way to collect the star again after it has been collected (the star no longer appears on subsequent plays) it should work fine.

    Otherwise, you'll need a flag system to keep track of each star and it's state, if it has been collected before or not. An array may be a more suitable method of data storage in that case.

  • Same answer? Or maybe I still misunderstand...

    Whenever you collect a star on any level, add it to a global variable counter. You now have the total number of collected stars from all levels.

    Global variables are global in that they keep their value across layouts.

  • Sorry it's not the value that's unknown, it is the number of them.

    For example, I can get the distance to each image point on a sprite, and I want to track the nearest/farthest one. But the number of image points may vary, depending on the animation frame/state, so I can't just use the min/max expressions...

  • Got it, it was instance 0. But first you may need a "pick all sprite" condition. The IID is an indexed list of only currently picked objects - so depending on how you had your events set up, if you just created one, that would be the only picked instance, therefore Sprite(0) is that one. If you pick them all, Sprite(0) is the oldest. Here is an example - https://www.dropbox.com/s/am9vst1j6bl6ily/iid.capx?dl=0

  • Whoops maybe I was backwards. If 0 is the newest, then Object.Count-1 should be the oldest.

  • https://www.scirra.com/manual/124/system-conditions

    [quote:1yn1gpzj]Pick Nth instance

    Pick the instance at a given place in the internal list of picked objects. This is most useful used in sub-events to act on separate instances. For example, in a "Sprite collided with Sprite" event, Pick 0th instance and Pick 1st instance can be used to act on each instance involved in the collision separately.

    If all objects are currently picked, this condition can also be used to pick an object by its index ID (IID). For more information, see common features.

    After picking the 0th instance (oldest), you action (destroy) will then only apply to that instance.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I don't think three is anything built in. What would be your usage?

    Actually I would probably have a seperate dedicated semi transparent sprite with angle markers I would use as a reference for ranges when doing level design. Just drag it around to wherever i need it and destroy on start of layout.

oosyrag's avatar

oosyrag

Member since 20 Feb, 2013

Twitter
oosyrag has 38 followers

Trophy Case

  • 11-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • Enduring Visitor Visited Construct.net 90 days in a row
  • Unrelenting Visitor Visited Construct.net 180 days in a row
  • Continuous Visitor Visited Construct.net 365 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

21/44
How to earn trophies