AllanR's Recent Forum Activity

  • use the Browser Object - Go to URL.

    To display a photo, load it into a sprite.

  • You could add an invisible solid object behind the bridge for the player to walk on...

  • The manual drawing part with the mouse is just a way to test out different paths of various shapes quickly and to test concepts. It would be possible to randomly generate a path once you decide on basic parameters of what you want, or save a path after you have drawn it and add that to your game... (the path is just a series of points - most of the paths I was trying were about a dozen or two points.)

    MadSpy is doing a great job on what you are specifically after, I have seen quite a few people asking about how to make an object follow a path, and wanted to play around with a more general solution to the problem. So I had a bunch of concepts rattling around in my head - like could the path adapt itself to avoid obstacles, apply physics to the object so that it accelerates downhill and slows down going uphill, etc... Its a fun exercise to experiment on! C2 never ceases to amaze me. : )

  • I tried a slightly different approach... you draw a line by holding down the left mouse button. When you stop drawing, an airplane is created on the line and follows it.

    as the line is drawn, it is divided into a series of "nodes" or segments. Each node knows where to find the next and previous node. (a value of -1 marks the beginning or end of the chain - the plane reverses direction when it hits an end.)

    The code is very messy. The plane follows the line exactly as it appears, and sets the plane's angle to the angle of each segment - so the motion is not very smooth. I would want to either automatically smooth the line after it has been drawn, or have the plane smoothly transition from the angle of one segment to the next, and probably would do both... I also briefly thought about having the capx export the node list in json format so that a path could be easily imported into another project for an object to follow.

    You can draw multiple lines. There is a speed variable if you want the planes to move faster. There is a lot of room for improvement! : )

    you can download the capx here: http://www.rieperts.com/games/forum/follow_line.capx

  • I would divide the line up into a series of points (the more points, the smoother the motion would appear). Each point would be a way-point, and you could determine the angle difference between each point to tell your sprite to rotate as it goes around the loop...

    Each point should have a sequence number, so you can tell what the next (or previous) point should be...

  • I downloaded your capx file from the thread above and it crashed for me after a couple hundred coins were created...

    then I removed the regular physics behaviors and changed them to Chipmunk physics. I am up to over 2500 coins, and it has been running for around half an hour with no trouble. (I also added a text box that displays how many coins there are).

    I first tried Chipmunk physics last week when I needed to know how much force was being applied to an object and the regular physics did not seem to have a way to do that. But I was amazed at how much faster my game ran on my iphone with Chipmunk physics. With the asm.js physics it would stutter and was barely playable, but with Chipmunk physics it ran smoothly (as well as giving me the extra info I needed). So, I would give that a try!

  • well, there would be a variety of ways it could cause a performance hit: in addition to memory, they could reduce your FPS if they are being moved around, or have behaviors that eat up CPU time, or are triggering collision checks.

    Why would you need a lot of empty sprites? to hold data? You could store data other ways.

    I know there are plenty of good reasons to use invisible sprites (I use them to track touch points in a multi-touch interface, or make larger targets around small objects that are otherwise difficult to touch on a small screen), but just make sure you use as few as necessary and keep them as simple as possible (no behaviors, disable collisions, etc.)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • well, there could be many possible ways to do it... you could have an animation play on collision with the floor (so the compression effect would be done through the artwork). If your object is complex, you could use Spriter to build an animation where the parts squish together. If your object is simple, like a ball, then you could just adjust the height of the object to make it looked compressed for a short while, then set it back to normal...

  • DetteMan

    easiest way is to create an event for your object (blocks or whatever), use "Is playing animation" (and give it the name of the animation you want),

    then add an action to set a variable or display in a text box: objectname.PickedCount

  • Yeah, either you have to assume what the max is (100), or you need to store what the max is.

    You could have a table (array) that holds the max for each type of unit / enemy rather than store the max in each instance, but then you have to store the unit type in each instance so you can look it up in the table - so you aren't really saving anything, unless there is other data you want to define for each type as well - size, weight, weapons, abilities, vulnerabilities, etc. Then it would save on variables if you store just the type, and then look up all those other attributes (including MaxHP) based on the type, rather than having every unit duplicate all info that is the same.

  • put all enemies in a family and make those variables instance variables of the family, then everyone will inherit the default MaxHP. You can override individual enemies if you want to make them stronger or weaker.

    But you do need both variables to calculate what percentage dead or alive they are.

  • well, you could add another Boolean flag for the exempt ones, then only delete the ones that aren't pinned and not exempt.

    Edit: actually, you could probably do it with one flag - just the exempt flag. When you pin an object, just make it one of the exempt ones.

    Then after recreating objects, only exempt ones would be duplicates. I guess you would have to check for the exempt flag in an On Created event, and delete them there.

AllanR's avatar

AllanR

Member since 21 Nov, 2013

Twitter
AllanR has 23 followers

Trophy Case

  • 10-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
  • Popular Game One of your games has over 1,000 players
  • x2
    Coach One of your tutorials has over 1,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

19/44
How to earn trophies