gnuss's Forum Posts

  • (x2 - x1)^2 + (y2 - y1)^2 = distance^2

    distance = sqrt((x2 - x1)^2 + (y2 - y1)^2)

    My brain hurts after reading that , my math skills are a bit rusty so I had to think about it for a little while, but I do get what you mean. Fortunately my game is so simple it only needs to calculate distance on the x axis, but I'll keep this in mind if I need it later on.

    I have another problem though, I want to add more orange boxes, and have each orange box choose the purple box closest to them.

    <img src="http://farm3.static.flickr.com/2411/2427819224_0a235ec3a0.jpg?v=0">

    How do I make each orange box choose their own closest purple box? Needless to say, the solution with a distance variabel with the value abs(player.x-enemy.x) only seems to work with one player. I tried experimenting with the for each condition but it got me nowhere.

    Any help is appreciated!

  • I think it might be 'absolute' Abs(value).

    This does the trick!

    abs(player.x-enemy.x) works perfectly!

    Thanks guys!

  • Thanks for the answer

    I tried simply setting "distance" to player.x-enemy.x

    and then "pick with lowest variable".

    This causes one problem though, if one of the enemy instances are to the left of the player, the value "distance" will be a negative value (like -200), and will therefore always be picked before a positive value (like 100).

    see here for example cap: http://www.mediafire.com/?byy26uv0ybn

    Is there a way to do this that I have missed? Or perhaps a way to change negative values into positive values?

  • I'm having some trouble trying to figure out how to make my player object pick the closest instance of another object.

    <img src="http://farm3.static.flickr.com/2287/2425640857_df5752fc31.jpg?v=0">

    I want the orange box (the player) to move to the closest purple box. I have made all the events to make it move of course, but I can't figure out how to make the player actually pick the closest purple box. Any bright ideas guys?

  • Yeah that makes sense

  • What's the difference between "Has LOS to object" and "On object in LOS"?

  • It works fine for me, I'm not getting any crashes.

    I forgot to add a behavior to the sprite

    If you try adding a behavior to the sprite called "unit", does it still work fine?

  • I'm trying to make a "selection box thing" like in lemmings. I added a "Pick random" event to make sure only one unit is chosen if the "selection box thingy" overlaps two units at the same time. This crashes my game, but ONLY if the units have a behavior. If the units do not have a behavior it works perfectly. I'm not sure if this is a bug though or if it's just me doing something wrong.

    Here's the cap: http://www.mediafire.com/?yznml0wdew1

    EDIT: This cap is without behavior added, try adding a behavior to the sprite called "unit" (any behavior will do I think) and it should crash.

  • Thanks to everyone for their answers But I haven't quite figured out how to do this yet. I ran into some problems with the canvas, since I'm using platform movement as well. If a sprite with platform movement is placed on top of a canvas object with the solid attribute, the sprite will treat the entire canvas object as solid, not only the non-transparent pixels. So the sprite will be standing in thin air.

    (or maybe I have misunderstood how you're supposed to use the canvas, that is also a very real possibility )

    AS for JayJay and Casho's suggestions (thanks for the .cap ), this method seems to be working, but I'm worried about how much resources this would use on a large scale? It could easily be several thousand sprites. I'm worried that would give performance problems, but I'm not sure, does anyone know how many sprites are too many?

    As for using a mask I'm pretty clueless on how I would actually do that in Construct?

    Any help is appreciated

  • I was wondering if there is any way to make destructible terrain in Construct? (the kind of terrain that is in worms and lemmings)

  • This used to happen to me in 0.91, but it's gone for me now. As far as I can tell it does nothing harmful to the .cap, just save, close Construct and restart it when it starts happening.

    That's good news:) Thanks guys

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That sounds like good news! )

    Does this affect the .cap in any way though?

  • This strange bug has happened to me several times now: While working in an event sheet, all icons will suddenly turn into empty white boxes, and after a little while buttons start disappearing (like the buttons that let you switch between the layot editor and the event sheet editor) and Construct becomes unresponsive. One or more windows pop up and say "An invalid argument was encountered." Shortly afterwards the program will crash to desktop.

    If I reopen the cap it will seem fine (even if I saved as my buttons were dissapearing). I can do some more work for like 5 minutes and then the bug will happen again.

    Is this a problem with my .cap or with something else?

    I can handle the truth, I have plenty of backups