tulamide's Forum Posts

  • Hi fellow game designers,

    I decided to open this thread to post tips and tricks here from time to time. I will concentrate on programming rather than on design, and on more simple but effective tricks rather than the next 20000 line code segment.

    If you are an experienced programmer, you probably won't find anything new or exciting here. But if you have made your first steps into programming and want to go deeper, than you're at the right place.

    I don't know how frequently I will post here, so don't ask or try to force me^^

    If you have suggestions, I'd be happy to read them.

  • If you need a specific number of decimals, you better use FormatDecimal(number, N), because str() will convert 2.40 to "2.4", omitting the last 0

    With FormatDecimal(2.4, 2) you will get a string with 2 digits for the decimals "2.40"

    Likewise, FormatDecimal(2.41, 3) will return "2.410", etc.

  • That's not a text object bug, but a family issue. You need to manage all private variables of a family from within the family manager, and even then it makes problems sometimes. I don't know any workaround besides deleting all pv, re-creating them in the family manager and hoping for the best...

  • Just make the objects of the inventory layer, that you create at runtime, 'global' (under properties->common)

    Objects (and instances) that are local and are created during runtime will get destroyed as soon as you switch to another layout. To keep them alive, they need to be global in scope.

    Here's the extended example cap: inheritance2.cap

  • The layer pops up in its original form but not with any of the sprites that have been added to the layer.Then you've done something wrong. Here is a basic example: inheritance.cap

  • I recommend reading the wiki. This is the page explaining the system expressions: scroll down to "Math"

    clamp is just one of many functions that are common to most programming languages. The best practice is to read about them, look for descriptions/examples on the net and try for yourself. Then you are aware of them in case you need them.

    Math functions you will almost always need somewhere somehow:

    sin(), cos(), min(), max(), clamp(), ceil(), floor(), round(), abs(), lerp()

  • Just build one with graphics and events. Here's an example to help you get started: slider.cap

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Nice solution you found here.

    sin() and cos() work on a specific angle, not an angle range. That's what I meant in my first post. The line of sight behavior also needs an angle but calculates it from the positions of Baddie and TempX/Y, so you don't need to calculate it yourself.

  • I see. So you want to spawn it on some random spot and just make sure it is a minimum distance away from all other ones? Than your proposal is the easiest one. You should go for it.

  • To keep a distance, you'd need at least an angle. If you have nothing, you have to play it safe. One way to do the safe way is this:

    + [creation trigger]

    ++ For each baddie

    +++ baddie.x < global('lowX')

    ---> set global 'lowX' to baddie.x

    +++ baddie.x > global('hiX')

    ---> set global 'hiX' to baddie.x

    +++ baddie.y < global('lowY')

    ---> set global 'lowY' to baddie.y

    +++ baddie.y > global('hiY')

    ---> set global 'hiY' to baddie.y

    ++ [empty]

    --> Create baddie at

    (lowX + (hiX - lowX) / 2) + cos([your angle of choice]) * (distance(lowX, lowY, hiX, hiY) / 2 + [your distance of choice])

    (lowY + (hiY - lowY) / 2) + sin([your angle of choice]) * (distance(lowX, lowY, hiX, hiY) / 2 + [your distance of choice])

    Here's a picture describing the code above:

    <img src="http://dl.dropbox.com/u/11182740/pictures/get_distance.png" border="0" />

    By calculating the lowest and highest values for X and Y of the sprites (the blck dots) you get two new coordinates (the crosses) that are the outer bounds enclosing all sprites. If you now half the distance between them you have the radius of a circle with a center point between the two coords (red line = radius, red dot = center point, orange line = distance between coords). With the center point, the radius, any angle and your desired minimum distance you can now set a new spawn point.

  • Thank you <img src="smileys/smiley1.gif" border="0" align="middle" />

    QuaziGNRLnose

    It replaces the palette line, not with transparency but with whatever is to be drawn there. The object works as a palette on input and as a canvas on output.

  • I guess all game devs that posted here are using win7? Because I tested it on my WinXP SP3 and when I tried to close the demo via red button I saw a message from 'Data Execution Prevention' (DEP) for the first time in about 10 years of using Windows. It gets active if a program code tries to execute from protected memory (non-executable parts of the memory). After closing the message the space blaster demo crashed. To stress that: There were no issues as long as the demo was executed, only when trying to close it the protection gets active.

    Ashley: Is it a bug in Awesomium, or in C2? Or is it simply incompatible with WinXP?

  • I hereby nominate this as the coolest wikipedia article title ever.So this makes newt the coolest dawg out there, right? <img src="smileys/smiley2.gif" border="0" align="middle" />

    Cause this article is about exactly what newt said, weighted chance random.

    <img src="smileys/smiley4.gif" border="0" align="middle" />

  • You're welcome <img src="smileys/smiley4.gif" border="0" align="middle" />

  • There is no better way, but there are two other ways, that should be preferred.

    The first one is simply seperating the image from the mask by using two objects. One shows the image, one serves as a mask.

    The second way is using the "launch explorer" option by right-clicking on selected frames in the animation tab. This will export all selected frames and their masks as seperate images, that you can change as you like and then re-import. Here's a video from David showing it:

    Subscribe to Construct videos now