Valhallen's Forum Posts

  • If I'm understanding the situation correctly you can simply try using a variable or something to check which weapon is currently equipped, so if shoot+variable=1 -> shoot weapon type 1; if shoot+variable=2 -> shoot weapon type 2, etc.

    The idea of a generic "Fire" function call is to avoid having to write a conditional for every single weapon type in the game, and keep track of which number or string equals which weapon type. The weapon should handle any logic associated with it, and the player just needs to know that a weapon has a "Fire" function.

    It's very bad practice in programming to do what you're suggesting, but I don't see any other option in C2...

    Ideally if I'm forced to manage strings like this, the "OnFunction" action should have a dropdown selection of all declared function names, rather than having to manually type in the string again. Or just more variable types, or even an Enum object...

  • I have my player, and he has a weapon. When the user clicks, I want to tell the weapon to fire. Each weapon needs to have its own implementation of "Fire" as some of them shoot rockets, others bullets, others lasers, etc.

    The "Function" object is not really a function object, it's an event broadcaster/listener object, so I can't just call function "Fire" or all weapons in the layout listening for "Fire" will fire.

    How can I get a reference to the player's current weapon, and tell that specific instance to run its "Fire" implementation?

  • 1. you can still use ctr+shift+left arrow/right arrow to shift the selection over entire words

    Hey thanks, I did notice that this still works -- I use it in tandem with ctrl+shift+end/home and I've been deleting by selecting first. It's part of the reason I find it annoying that I can't just delete in the same way.

    Thanks,

    Jeff

  • TiAm

    When I first started using Construct 2, I could immediately see the potential, and how it was hindered by the antiquated interface. I wasn't aware that Construct 3 was in development, but I'm glad that the main goal is fluidity and being extensible. I'm also glad that to see that it is backwards compatible and hopefully my license will transfer. Good looks! I can see that Construct is headed in a great direction.

    Is there any idea of a timeframe for the alpha/beta? I'm hoping 2015.

    Thanks,

    Jeff

  • I don't have access to C2 at the moment, but...

    4. I thought there was. At least you can scale the tiles up for sure. I'd assume it can go the other way.

    5. I could be remembering wrong but I thought if you right clicked the animation name then preview was one of the options.

    6. If you closed the image editor and you didn't want that change, you can use undo to revert it.

    Hey, thanks for the response.

    #4 - You can only zoom in with right click, not zoom out. I would wish this to be ctrl+scroll for consistency, and to go both directions.

    #5 - You are correct, I overlooked that. Thanks!

    #6 - This does work, although it seems strange to me that actions in the image editor are applied to the global history. Thanks!

    I will remove those points from my original post.

    Thanks,

    Jeff

  • Hey there, today is my first day owning a Construct 2 license. I work as a Unity Developer full time currently (my heart belongs to Unreal Engine 4 though), and I decided to try out Construct 2 for some personal projects aimed at the web.

    I've only been using Construct 2 for a day so far, and there are a few annoyances that I'd like to ask about. Please enlighten me if I've made any silly oversights.

    1. I noticed that I can't use Ctrl+Delete or Ctrl+Backspace to delete words in comments. I cannot stop myself from doing that, and a little bit of me dies every time it doesn't work, as it works when writing expressions.

    2. When adding a number to field, why does an error occur when I type a float .5, instead of 0.5? Why doesn't it just automatically tack on the 0 in front of it?

    3. If I make a spelling error in an expression while typing the beginning of an object or variable name, I have to delete the whole name, and then delete and retype the period in order to get the list to come back up. I wish it would just come back as soon as it detects a valid name, as soon as I fix the spelling error.

    4. I wish there was a zoom out scalar in the Tilemap window. My tiles are high resolution, and I can only see like three or four at a time because they are displayed at full resolution. I do not want to have to expand that window to a huge size, or take up space on my other monitors. Currently there is a right click menu for zooming in. I would wish this to be ctrl+scroll for consistency with the layout editor, and also support zooming out.

    I'm sure there are a few more I'm forgetting at the moment, but that's all for now.

    All that being said, I love the engine! It's extremely fast to build with, and I love the debugging tools. Not everything is as easy or intuitive as I would like, especially coming from a programming background, but overall I really enjoy using the event system. A few quality of life improvements and I'll be a happy camper.

    Thanks,

    Jeff

  • Do you have the wrap behavior on both the object and the player?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can use 'wallclocktime' and just subtract the last value from the current value. You don't need to keep track of the time directly, just store that time on a click and use that as a reference on the next click.

    That's a good solution, I wasn't aware of "wallclocktime".

    To add to that, I would suggest you store the time when the next button spawns, rather than on click in case there is a delay between buttons.

  • That's okay. How about this:

    Say your sprite starts facing to the right:

    When you press left, your sprite flips 180 to face left. When you press right, your sprite flips 180 to face right again.

    When a bullet object gets spawned from your sprite (your sprite will do "spawn another object"), it will automatically be facing the same direction as your sprite.

    Don't worry about the mouse controls in the video, just focus on how he spawns the bullet. You can use the same thing in your game when you press the spacebar.

  • Hey there, check out this tutorial about spawning bullets: "Game Development w/ Construct 2 Tutorial - 8 - Shooting Bullets" by TheNewBoston on YouTube.

    The bullet will go in the direction the sprite is facing, so if the sprite doesn't flip when you change directions, you'll have to keep track of which way the sprite is facing based on the last movement input, and flip the bullet direction manually.

  • You can use the "dt" (delta time) expression to get the amount of time elapsed since last tick. Add "dt" to a variable on tick, and when the button is pressed, get the value in the variable and put it in a list of recorded times, and then set the time keeping variable back to 0. At the end, you take the average by adding all the times in the list together, then dividing by the number of times in the list. So you would be dividing by 10 after adding all the times together.

    Alternatively you can also use Timers to record how much time has passed. Instead of adding delta time every tick, you could set a timer to execute every 0.1 seconds, and add 0.1 to the time keeping variable. This would be more optimal as you're not doing something every tick, only every 0.1 seconds, however this would be accurate only to a tenth of a second. You could decrease the timer interval to increase accuracy.

  • You should make sure that you only check the condition one time when experience is added, rather than on tick or at an interval.

    Alternatively you could keep track of how much experience has been gained since the last level up. If that value becomes greater than 100, then level up and set it back to 0.

  • Thanks for the response. I will do some research into the AJAX object and try to find any simple JSON plugins.

  • I've haven't actually used Construct 2 yet, but I see in the documentation there is a System Condition called "Compare two values" which can take two expressions.

    An expression is something that needs to be evaluated before the condition is checked. You can type it right in, instead of a simple number.

    [quote:ooh7maok]Compare two values

    Compare any two expressions (which can either numbers or text) with each other. They can be compared as Equal, Not equal, Less, Less or equal, Greater or Greater or equal.

    You'll want to use the "Greater" comparison.

    I plan on testing out Construct 2 tonight, so I'll come back and add some more detail to this post if you haven't figured it out by then.

  • You're going to want to check if your experience value can be divided by 100 with a remainder of 0.

    For this, there is the modulo operator %. Modulo gives you the remainder of a division.

    examples:

    200 % 100 = 0

    301 % 100 = 1

    950 % 100 = 50

    therefore:

    if experience % 100 = 0 then you know the experience is a multiple of 100.

    This won't work if they surpass the multiple of 100, going from 99 to 101 for example, so you'll have to do something a bit fancier like this:

    (Warning, some math and programming shenanigans)

    It boils down to this condition, which I will attempt to explain:

    floor( currentExp / expNeededToLevel ) > floor( oldExp / expNeededToLevel ) -> if true, level up!

    "floor()" rounds whatever is in parenthesis down to the nearest integer (whole number). So 0.9 would round to 0 -- and 1.1 would round to 1.

    "expNeededToLevel" is the amount of experience needed in order to level up (in your case this is 100).

    "oldExp" is the experience value BEFORE adding new experience.

    "currentExp" is the experience value AFTER adding new experience.

    ">" is the "greater than" operator and checks if the value on the left of it is greater than the value on the right of it, and says true (1) or false (0) about it.

    So if your character had 99 experience, then killed a bug and gained 2 experience, it would go like this:

    expNeededToLevel = 100

    oldExp = 99

    currentExp = 101 (after adding 2 for the bug)

    So if you remember the condition from above:

    floor( currentExp / expNeededToLevel ) > floor( oldExp / expNeededToLevel )

    If I plug in the values you get:

    floor(101 / 100) > floor(99 / 100)

    which reduces to:

    floor(1.01) > floor(0.99)

    after floor reduces to:

    1 > 0

    meaning "one is greater than zero" which is a true statement, so your character needs to level up!

    You can replace 100 with any number of experience you want.

    I hope this helps you.