oosyrag's Recent Forum Activity

  • I used:

    Every x seconds, ammo != 0, reloadtime = 0 | fire bullet, subtract 1 from ammo

    Else if ammo = 0 | increment reloadtime by 60*dt

    When reloadtime > x | set ammo to clipsize, reloadtime to 0

    This was for player controlled firing though, where it is possible to stop in the middle of the clip. Using wait actions in a function would indeed be the simplest.

  • What do you mean by steal focus?

  • I see what you mean, maybe we should scrap that idea then.

    Here's something I put together without any behaviors. I've added some constraints and used dt where I remembered to, so it should be fairly future proof. Hope you can modify it to suit your needs, or figure something out using it as a basis.

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

    I feel pretty sure there is a cleaner way to do this, but it is what I came up with off the top of my head. Maybe someone else can provide a better way.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just found out the array object had a sort action that I never even realized was there, sorry if I made it sound more complicated than it was. The sort action makes it much simpler!

    Here are two examples, one using an array and one without using arrays.

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

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

    I didn't add the actions for what happens on success or failure besides destroying the text on success to show it works, try to give your best shot at implementing a scoring system on your own.

  • Nabu,

    Running a thousand loops will take just as long all running in one frame, or split 100 each into ten frames. The advantage of splitting them is that you can update a progress par for instance, since you get frames during the duration of the loop to draw updates.

    That said, there are generally many ways to optimize loops to speed them up, either by reducing the number of loops, lowering the amount of data that needs to be checked by conditions, reducing the actions taken per loop, ect.

  • Set up your object with "Car" and "Rotate" behaviors.

    For the car behavior, you'll want to turn off default controls. Set up your W and S to simulate "accelerate" and "brake".

    Set the rotate speed with A and D, one positive one negative. Make sure you have an "else" event after that sets speed back to 0, so when your keys are not down it stops rotating.

  • Ok, the key here is that you pick the menu object by touching it, then compare the contents of that specific menu object to do something. In this case I would want to follow a similar system/logic for a keyboard press, so I don't have to remake all the actions for every menu option again separately.

    The question should be - How do I pick the correct menu object On Return pressed? There are a several ways. Use your marker, which is presumably next to the relevant menu object, by:

    a. Menu Object - Pick Nearest to Marker.X, Marker.Y

    b. Menu Object - Compare X position equal to Marker.X

    c. System - Pick by Overlapping Point - Marker.X

    Now that you have the correct menu object picked, the rest should work as expected.

    Here is a screenshot of how to set up the sub-eventing, since you'll want an or block in there.

    If you've touched to pick the menu object, the subevent doesn't matter because there is only one instance to pick from anyway. If you used keyboard, none of the menu objects are picked, so the subevent will pick the one you are interested in. Every sub event below that will only care about that one menu object that you picked.

    I noticed that you used a Family to destroy all the menu objects (since if you used destroy on the object itself, it would only destroy the picked "active" menu object). Just wanted to note an alternative - there is a "Pick All" condition in System that would let you reset the picking within a subevent to properly destroy all the objects. This is mostly for the reference of people demoing C2, without access to families.

  • 1. Generate a random set of numbers using the random() expression. To determine the number of random numbers generated, you can use a loop - repeat random(4,10) times. Create text, set text to random(x,y). Random() can be set to a negative number

    2. One way to sort your randomly generated numbers in order, probably in an array. There are multitudes of ways to do this. Ref: https://en.wikipedia.org/wiki/Insertion_sort Edit: Just use the sort action!

    A simple way I can think of to simulate the effect you are looking for, is to compare the selected number with ALL the other numbers. If ANY other number is less than the selected number, then fail and start over, set points, ect. Else if no numbers are less than the selected number, then delete that number and move on.

    This will only work for numbers, and in order from smallest to greatest or vice versa.

  • The keyboard plugin has no properties.

    After you add the keyboard object you can use keyboard conditions and expressions in your events, as described on the manual entry here. https://www.scirra.com/manual/113/keyboard

  • Can you give an example of some the texts on your layout, a sample of what a player can input, and which of your texts would count as "nearest"?

  • This is part of the learning process of coding. As you get more experience working things out yourself and exposure to other's solutions via the community, you will gradually build your own foundation for certain logical thinking.

    Otherwise, there is no shame in asking no matter how experienced you are. this community is great and other people have likely already gone through what you are stuck on. I myself find solving other's problems enjoyable, like small puzzles (the ones I can handle anyway). Helps me keep my mind off my own projects and problems I'm stuck on :p

  • So basically you want a motion that is NOT natural physics.

    You'll need an additional event to artificially cut the momentum of the object, either by comparing the distance travelled, time since launch, or height position, up to you.

    Edit: Or make an invisible solid ceiling for your sprite to bonk its head into.

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