dop2000's Recent Forum Activity

  • You can use something like this:

    Set platform speed to abs(Touch.Gamma)*10

    Or with clamp to limit minimum and maximum speed:

    Set platform speed to clamp(abs(Touch.Gamma)*10, 100, 1000)

    The more the phone is tilted, the higher the speed will be.

    You can use a similar formula for acceleration.

    Of course you'll have to experiment a lot to get these numbers right.

  • It would be much easier if you shared a capx..

    Ok, first, event #4 should not be nested under "On start of layout". But even if you move it, it will still change state for all NPC at the same moment.

    If you want NPCs to move "chaotically" each at different time, the best way to do this is to add Timer behavior to NPC, start it for random(1,3) seconds, then On Timer event change NPC_state variable and restart the timer again for random(1,3) seconds.

    Initial "Start Timer" can be under "On start of layout" event.

    "On Timer" should be a top level event, like #1, #2 and #3.

    Event #6 is executed every tick, you should not use "Wait" inside such events, this can cause all kinds of troubles. Change your event #7 to this:

    eNPC_state=0 -> Set platform speed=0

    Else -> Set platform to maximum speed

    In event #14 as you are using "toggle boolean", when your NPC see player, they are constantly switching between being casual and annoyed about 60 times per second, because it's also triggered on every tick.

    So you need to add another condition "obj_actor_enpcmask is NOT annoyed" to event #14.

    Also, you can remove "casual" variable. NPC is either casual or annoyed, it can't be both, right? So you only need one boolean variable - annoyed.

    And finally, you don't really need "For each NPC" in any of those events, but it's ok that you have it. I believe it's a good habit to use "For each" condition, it makes the code more logical and can prevent some potential problems.

    I might have missed something, next time please share your project capx.

  • Pipes in this game only exist for about a second, then get destroyed. So we are talking about creating new pipes, no need to change movement for existing pipes.

    Code example that I gave changes Sine movement to vertical for all newly created pipes after 5 seconds of playing.

    You can modify it like this:

    variable MovementType=0
    
    Every 15 seconds
        Add 1 to MovementType
        MovementType=4 -> Set MovementType=0   //  this will reset back to 0 after 60 seconds
    
    Every 1 second ->    Create object bottomPipe
       // no need to add "MovementType=0 -> set movement to horizontal", because that's the default movement
        MovementType=1 -> bottomPipe Set Sine movement to Vertical
        MovementType=2 -> bottomPipe Set Sine movement to Angle
        MovementType=3 -> bottomPipe Set Sine movement to Size
    [/code:d6jam51w]
     
    This will do what you want - first 15 seconds pipes will have horizontal movement, next 15 seconds vertical, next 15 seconds angle, then size, then back to horizontal.
    
    Another way to do this is to add 4 Sine behaviors to the sprite, one for each movement type (rename them to SineHoriz, SineVert, SineAngle, SineSize). Then by enable/disabling them with events you can create combinations of movements, say horizontal+angle, vertical+size etc.
    
    One more thing - it's better to use Timer behavior instead of "Every X second".  With Timer you have better control, you can stop it, restart, check remaining time etc.
  • Does your spritefont (image) actually contain capital letters?

    It works for me:

    https://www.dropbox.com/s/fvc47qc5chedo ... .capx?dl=0

  • I don't really understand what you mean. If you share your project or a screenshot of your events, I may be able to explain what's going on.

  • The pipes are moving too fast and disappear from the screen before they change Sine movement.

    But now I understand that you wanted to change movement at the moment the sprite is created, not 5 seconds after it was created.

    I'm guessing you want to create pipes with Horizontal movement for 5 seconds, then with Vertical movement for 5 seconds and so on?

    You can do this with a single variable, say verticalMovement=0

    Every 5 seconds
        verticalMovement=0  -> set verticalMovement=1
        Else -> set verticalMovement=0
    
    Every 1 second ->    Create object bottomPipe
        verticalMovement=1 -> bottomPipe Set Sine movement to Vertical
    [/code:2h6s54w7]
  • So "On key pressed" is the only condition and it's not inside some other event like "Every X seconds"?

    Then it should work.

    Do you use TextBox? When cursor is in the TextBox, some keyboard events may not work.

    If nothing helps, please share your capx.

  • It's hard to tell without seeing your code.

  • I still don't see any errors.

    Could you save your project as a single file (capx) and share it?

  • No, it's all correct. I did the same and it works for me.

    Maybe there is something else in your code that breaks it.

    Did you set "active on start=yes" for Sine?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • When you spawn a family instance, family member will always be picked at random, you can't predict it.

    Why did you make them as separate objects anyway? If the only difference between bullets is their color, you can put them all in one sprite (as 3 frames or 3 animations). Then simply spawn this sprite and change its frame/animation.

dop2000's avatar

dop2000

Member since 26 May, 2016

Twitter
dop2000 has 256 followers

Connect with dop2000

Trophy Case

  • 8-Year Club
  • Entrepreneur Sold something in the asset store
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • 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
  • Forum Wizard Made 5,000 posts in the forums
  • Forum Unicorn Made 10,000 posts in the forums
  • x5
    Popular Game One of your games has over 1,000 players
  • x2
    Coach One of your tutorials has over 1,000 readers
  • Educator One of your tutorials has over 10,000 readers
  • 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
  • x3
    Quick Draw First 5 people to up-vote a new Construct 3 release
  • x13
    Great Comment One of your comments gets 3 upvotes
  • Delicious Comment One of your comments gets 10 upvotes
  • Email Verified

Progress

28/44
How to earn trophies