AllanR's Recent Forum Activity

  • Solomon - another way is to use a global variable:

    On Start of Layout B --> set NextSpawnTime = Time + 5

    then, instead of every 5 seconds:

    System Compare two values ( Time >= NextSpawnTime ) --> spawn box, and set NextSpawnTime = Time + 5

    The only thing to watch out for is if you pause the game (or open a settings menu, or display a message) - you would have to save the remaining wait time:

    TimeToSpawn = NextSpawnTime - Time

    then when you unpause, set NextSpawnTime = Time + TimeToSpawn

  • ij3m

    Like Taser said, gravity is already build in to the Platform behavior. You can change its value in the properties panel, or at run time (if you want stronger or lighter gravity, you can also change the Angle of Gravity). The default value is 1500. As long as there is a value for gravity, everything will happen automatically. There is no need to do anything in the OnJump() event (other than change animations, or things along those lines).

  • give your object the Sine Behavior...

    (you would have to post a .capx file for any one to test it out. the caproj file is only some of the code - not enough to open and test a project.)

  • Solomon

    do the layouts share the same event sheet?

    there is an event "On Start of Layout"

    I had a similar issue that I thought might be some kind of bug, but turned out it was an error in my code. So, I would think there is something you are doing that is causing this - and it is impossible to say what it is without seeing your code.

  • jeebroniz

    in the Add Action window for an object, down at the bottom is a Z-order section.

    you can move an object to the top or bottom, or move it next to another selected object (in front or behind).

    Those functions should give you the ability to easily order your objects any way you want, The For Each (Ordered) performs extremely quickly for me, so it could be some other factor that is killing your performance.

    Every object has a Zindex value you can access directly to figure out its depth - there are lots of ways to make it work.

    like I said above, the main trick is to avoid ambiguous situations when comparing one object to another of the same type ( object.Zindex > object.Zindex doesn't make sense because C2 can't tell which specific instance is which). So, you have to pick the first object by the type, and the second one by a family (so you end up comparing object.Zindex > familyObject.Zindex) those could be any two instances you want, but now C2 knows which one is being compared to another of the same type,

  • rekjl (and jeebroniz - C2 can do exactly what rekjl wants using built in Z-order functions)

    It doesn't work to compare an object to others of the same object type directly - so what you have to do is make a family and put your object in that.

    then, when you click on an instance of your object, you can test to see if any FamilyObjects are overlapping. you can use PickCount to see how many there are, and you can loop through them to see if their Zindex is greater than the original object's Zindex to know if any are on top of it.

    one other thing to watch out for is the initial click could click on several instances of the object if you had a bunch in one spot. So, use the "Pick Top/Bottom" (and select top) to get just the one object you want, then look for overlapping family members.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • franknitty2 - the line of code that is deducting health is probably running multiple times. You might need to add a trigger once condition or have some other way to stop taking further damage for a short period of time.

  • JeremyBenson11 - well, I was just telling you it is not a bug in C2. The Line of sight behavior uses Solids as obstacles (unless you use custom obstacles). Since your object had the solid behavior, it was considered an obstacle, and therefore your player did not have line of sight to it. That is why the click did not work - not because there is a bug with mouse clicks on solid objects, but because your player did not "see" the object even if it was 5px away. (the "player unit has line of site to enemyUnit.X, enemyUnit.Y" was false, and that stopped the code from executing).

    removing the solid behavior was the correct fix, but the issue was the conflict between trying to see something that was obstructed, not because of a bug with mouse clicks in C2. (although, you could argue that line of sight should be able to "see" the obstructions - unless they are obstructed by something else. but that would be a feature to request)

  • Hi...Any idea ?

    I would give the ball an instance variable called something like "InSand"

    then if it enters the sand area, and the InSand variable is false, set it to true. (and set linear damping accordingly)

    then when the ball leaves the sand area and InSand is true, then set it back to false.

    that way you don't need trigger once, and having multiple balls wont make a difference. Once the variable is set properly, the code wont run again.

  • imothep85 you could use smaller invisible sprites at different parts of the tunnel and check those for collisions or to give the player the ability to fly...

  • Cam112549 - yeah, dropbox seems to be having trouble right now.

    Doesn't 8 direction already take care of mirroring? I don't think you have to manually do that...

    There could be a number of things going on: if your code checks for the right arrow first, then the left arrow, then if both keys are down, the left arrow will be processed last, so your sprite will end up mirrored. So, checking left first may improve things - but then you would have the same issue going the other direction.

    when your sprite is moving right, its 8direction.vectorX will be poitive. So you could set your sprite to mirrored only when both the left arrow is down and the 8direction.vectorX is negative. That way pressing left arrow to stop the motion wont make your sprite mirrored until it actually starts moving to the left.

  • JeremyBenson11 I doubt it is a bug in C2 - probably factored into line of sight, or maybe it was stopping the projectile. There is almost always an explanation - sometimes finding the reason can be difficult (and frustrating).

AllanR's avatar

AllanR

Member since 21 Nov, 2013

Twitter
AllanR has 23 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
  • 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

20/44
How to earn trophies