R0J0hound's Recent Forum Activity

  • I haven’t used the LOS behavior too much so I’m not able to reason about how to use it off the top of my head.

    You can do it without line of sight. Basically set the box to full width and if it overlaps a wall make it shorter till it isn’t. Here’s a rough example of that.

    Every tick
    — box: set position to player
    — box: set angle to player.angle+180
    — box: set width to 200
    
    While
    Box overlaps wall
    — box: set width to self.width-10
    
    Every tick
    — camera: set position to player
    — camera: set angle to player.angle
    — camera: move forwards -box.width pixels

    Only fail case you may or may not have to deal with is if the player is in the wall then it could cause an infinite loop. Quick fix is to use a repeat instead of a while so it would at least not freeze.

    It’s rough since it changes width 10px at a time. You can make the step shorter but that will increase the loop length. A more efficient method would be to start with big steps and refine it with smaller steps.

    Ideally if you used raycasting you could cast a ray and get the xy where it hits. Then if the distance from that point to the player is less than the default camera distance then use that instead.

    I would like to note that I purely do this for fun. I'm not a professional and have no obligation spend time to help on this forum.

    So to summarize, you have 8 global variables and you'd like to display them sorted high to low, and when you display it you want it to show the variable name with the score.

    To sort you need to get the list of values into some kind of array. That could be comma separated text, an array object or just just use multiple instances of a sprite. In the end they are all arrays just represented in different ways. I guess the main tricky part is sorting the values and knowing what variables the values came from. Anyways here are three different approaches, some of which were already covered, in one way or another, by the other helpful users on this site.

    Method 1. Text based array

    The first is to use a text variable to represent the array. list="01234567". This is the most compact way I could think of. 0 for the first global, 1 for the second and so on. Next to sort we'd have to implement our own sorting algorithm. Simplest and most compact would be bubble sort. Basically it compares two global variables from two adjacent indexes from the list and swaps the indices if needed.

    With this approach the expression chooseindex(index, p1,p2,p3...) is our friend to reduce the amount of events needed to access different globals with less events. Since it's text based the swap operation looks a bit ugly. Well in general all the expressions look busy with this approach.

    The main con with this is having to modify it if you change the number of globals you're sorting.

    dropbox.com/scl/fi/dn5oe5gwq0f9ltblvkazd/sortGlobals.c3p

    --- Three events long with an additional variable.

    Method 2: using the array object

    The second idea is to just populate an array with the global variables and sort that.

    We can recall the variable names by setting the array size to (8,2,1) and setting array.at(i,0) to the value, and (i,1) to the name or index. The sort only looks at values at y=0 and the other y's get swapped along. Anyway, it's easy enough and straightforward to use if you're not trying to avoid the array object at all costs. Most people with previous programming experience like this way.

    One con is the array sort action only sorts low to high. It's not the end of the world though. One fix is to just loop over the array in reverse like in the example, or setting the array with negative values before sorting, and negating them again when displaying.

    dropbox.com/scl/fi/4dz5bwz9ct7ex4anabvo0/sortArray.c3p

    --- Four events long with the array object

    Method 3: Using instances as an array

    With this you create a sprite type, and create enough instances for all the values. Then in events you populate the instance variables from the globals and use for each ordered to display it.

    This is where Construct really shines. It is simpler and looks much cleaner than the other two ideas. You just have to have the instances created beforehand to avoid picking pitfalls.

    dropbox.com/scl/fi/0t4vk3me4xkum6p41lz7l/sortInstanceVariables.c3p

    ---Two events long with an object type and enough instances

  • Not it would only add health when enemy health changes. Guess you probably would want a check to make sure the old health is higher otherwise the difference would be negative.

    Other than that, no, there are no such conditions other than saving the old health and checking if it’s different than the current health.

  • I mean you could first store the calculated damage in a variable and then subtract it from the health.

    By 40 do you mean you have the events you’ve shown duplicated 40 times with individual tweaks for different attacks?

    That just means there will be busywork for any change you go with. Personally I’d try to utilize a function to use less duplicated code.

    I guess a two event hack would be to add a variable to the monsters for their old health and do something like this:

    Every tick

    — monsters: set oldHealth to self.health

    … all existing events …

    For each monster

    — player: add 0.05*(monster.health-monster.old health) to health

    Maybe some other time.

    It was a friendly request by the guy that gave the most of his time trying to help. No need to get grumpy.

    I think today is a nice day for a stroll.

  • Scroll down to “contact us” and you can find the email there?

  • No need. Oosyrag covered it.

    In this context it’s fine using -infinity for volume. It converts to 0 anyways internally when the decibels are converted back to the 0-1 range for webaudio

    I mean with the formula

    Decibels = 33*log10(percent/100)

    We get approximately

    0db for 100%

    -5db for 75%

    -10db for 50%

    -20db for 25%

    -infinity db for 0%

    So decibels and percent are pretty interchangeable in that regard. Fading with one unit vs the other would give different results for sure. For a slider I’d use percent. With the numbers I’m not seeing how the top half would barely do anything.

    Construct and Audacity are the only pieces of software I’ve used that has decibels. I’ve certainly never played a game where volume was anything but a percent. Audio apis such as webaudio and fmod set volume in the 0-1 range, so basically a percentage.

  • Those debug console error messages are seldom helpful. Could it be an issue with a third party plugin? Maybe. Some were never tested with the minifier so that could be the issue. My only suggestion is to try exporting with the minifier turned off.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you exported to the arcade and uploaded the exported file it should work.

R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 157 followers

Connect with R0J0hound