R0J0hound's Forum Posts

  • That function is run when a top level event is reached, so the objects get destroyed and new objects added to the instance lists then. Without the hack can you access new objects by iid immediately after? If that works then something else is done behind the scenes to make that possible. Maybe instead of that second loop use "type.stale_iids = true;", so new iids are generated by the runtime instead. Untested but it seems to do that with families.

  • You can use an effect on a layer, and here's how to convert from hsl to rgb:

    http://www.niwa.nu/2013/05/math-behind- ... s-rgb-hsl/

    There may be a plugin that does this for you but I didn't look.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • [quote:3ib8m7r5]There are no benefits

    There are pros and cons to any change, so I disagree about there being no benefits. Long time users in my opinion have the privelege of requesting such advanced things because they already use the existing way to do it and see things to improve. Newer users are often directed to the manual or tutorials instead to get them aware of the common way to do things.

    Prominent

    You can test your idea by finding the "ClearDeathRow" function in preview.js and replace the two places "push" is used with "unshift". It will break the logic of any other capx that relies on the normal order of iids though.

    ...but why stop there, we can hack a toggle using a global javascript variable.

    change the line "type.instances.push(inst);" to

    if( window["createAtFront"])
       type.instances.unshift(inst);
    else
       type.instances.push(inst);[/code:3ib8m7r5]
    and do the same for the other push in that function.
    
    So by default new instances will be created at the end, but if you use the execute javascript action of the browser object with "window.createAtFront=true;" then that sets it to create from the front.  It should work even when minifying.
    
    You'll have to add the change every time you update c2, and you'll probably need to use an unmodified install whenever you encounter bugs in C2 because unofficial changes can't be supported by scirra.
  • You probably could do it with a plugin to manipulate the instance list. In the edittime.js make an action that takes an object type as a parameter. Next in runtime.js you can get the instance list and manipulate that. Here's a reference of what you can do with arrays in javascript:

    http://www.tutorialspoint.com/javascrip ... object.htm

    Actually after writing that out I realized it's more complex than that since new objects aren't added to that list till a toplevel event. So the action wouldn't work on newly created objects. It's probably a non-trivial change in c2's engine as well because of that, or even because of other deep engine reasons. Not to mention it's a unique requirement so it may not be readily added.

    Anyways, in cases like this I like to use an array that I store uids into as I create the objects, that way I have full control of their order. Maybe also using a function and a variable to make the expressions look less busy.

    As to the op you can change the iids of an objects by destroying them and recreating them in the order you want, at the expense of losing their uids.

    Maybe a more nifty feature request would be to use -1 instead of object.count-1 to pick the last instance. It currently doesn't work with the "pick nth instance" condition. It does work in expressions though: Sprite(-1).width

  • If it's an attack formation then you'd want one that provides for a maximum attacking at once so the skirmish ends quickly and friendly causalities are minimal. 5 for hand to hand combat since they can attack from all sides, and 3 for projectiles (arrow, bullets, rocks) because crossfire is reduced.

    1 would make the attack progressively more intense but I think it causes needless casualties of the initial ranks.

    4 is if we want it to be a fair fight, quite the favorite in video games for boss fights. This tests the endurance of the enemy.

    2 is just a harder version of 4.

  • This could be useful:

  • You could use the angle() expression on both vectors to get their angles, then use the anglediff() expression to find the angle between them. Another way would be to utilize a vector dot product to find the angle.

  • Found this javascript library here:

    http://onakasuita.org/jsgme/

    Got an example working in C2:

    https://www.dropbox.com/s/96184k4okj7vue7/nsf.capx?dl=0

    It's very basic and I've lost interest in extending it further. Also I won't be making a plugin version of it.

    To use the js at the start of layout loads the js libraries needed and the "loaded" function is triggered when it's ready to play something.

    Then to play a file use the execute js action of the browser plugin to run one of these three functions:

    play(file, trackNo)

    ex: "play(viper.js', 1);"

    It loads a file and plays a track. Tracks start at 1.

    playTrack(trackNo)

    ex: "playTrack(3);"

    It changes the playing track of the loaded file.

    stop()

    This unloads the file and stops playback. To play again you need to use the "play" function.

    EDIT:

    I just realized that the library used can play all kinds of video game music.

    https://bitbucket.org/mpyne/game-music-emu/wiki/Home

    eg. nes, sega genisis, gameboy, super nintendo

  • AnD4D

    If it crashes it's a bug, and I think that one is known. I haven't worked on it in a while but the plan was to rework the entire plugin so that's easier to fix. The crash is do to some logic error on my part, but it usually occurs when setting the mass under one of the plugin's trigger or loop events. The reason is under those events the chipmunk library itself won't let you change the mass, collision shape,... etc of an object. To alleviate that the change is just delayed till it's allowed to. In short it introduced too many special cases which made it increasingly hard to debug and fix, so an internal rewrite is needed in order to simplify things. I unfortunately don't have the time or interest to work on plugins to that extent, but at least for the most part this plugin is in a working state.

    Prominent

    Yeah, I never investigated handing layers with different parallax, rotations and such. I just left it as unimplemented. Tilemaps can't rotate as I recall, otherwise I would have let them if I could. That bug seems odd, looks like the tilemap's bounding box is being used.

    Waltuo

    Usually you'd keep the elasticity in the range of 0 to 1. I'd make the ground and the first ball 1, and the second ball 0.2 or something. When two objects collide their elasticities are multiplied together.

  • It probably is just the language the devs were most familiar with.

  • I tried it yesterday and it doesn't look right. Another idea is needed.

  • It may be enough to take the fog sprites and accelerate them to the speed the car is going. Then also have it deccerate over time. It may not look that great without the clouds interacting with each other but you'd have to test and see

  • The closest you can get is to paste the Sprite to a canvas object, read the pixels, calculate the tint then draw it back. This isn't fast at all so maybe you could do it when the game starts and draw by juggling the canvas objects.

    Another way would be to use blend modes to color the objects, however you can't exactly do a tint.

    Anyway to do this it's probably easiest to use the canvas or paster objects, although you may be able to do it with layers instead.

    Basically each Sprite will have a paster object positioned over it so the paster covers the Sprite. Then do these steps

    Fill paster with whatever color you want.

    Set the sprite's blend mode to source in.

    Paste Sprite to paster

    Set the sprite's blend mode to normal

    Then you just adjust the opacity of the paster object to change the strength of the coloring. You could also use the additive blend on the paster object for a different coloring.

    Keep in mind each instance of canvas/paster will use it's own texture.

  • You'll need to do this manually. One simple idea is to use a loop like:

    Number index=-1

    Repeat tokencount(text, ",") times

    Tokenat(text, loopindex, ",") = "fish"

    --- stop loop

    --- set index to loopindex