Zebbi's Forum Posts

  • Probably using the collision polygon.

    Tried pinning 8 different detectors, but it ate resources on mobile, so I'll have to go with the basic option of creating a spark under the car and using my imagination

  • You have to have different sound files for each type of screech. Then measure the angle of turn (or maybe the rate of angular turning) and play the different sound files for each subset of action.

    Yeah, can the rate of the turn be measured, independently from the speed of the car?

  • Well if a javascript library that doesn't use webaudio can be found, then maybe that can be used. Or you could just convert your mod files to ogg files with some other software perhaps.

    I will have to for now (convert to ogg), unfortunately, I'd like to know if it's possible to process module files without webaudio? Since the only bit that's really important to the listener is the output, couldn't the rest of the work be done without webaudio?

  • Done, I created and pinned each detector sequentially in a big 16 piece event, pretty ugly but I'm not smart enough to do it with an efficient, dynamic loop :/

  • Zebbi

    The collision polygon isn't accessible from just events. That said, you can manually put the collision point locations in an array or something and just reference that instead. Or you can use a tiny sprite to find the collision shape by moving over an area and checking for collision.

    What would the most efficient way of doing this be really? Looping a bunch of points around the sprite?

  • This corner of the internet has a way:

    http://acko.net/blog/javascript-audio-s ... th-html-5/

    But that's just the basics.

    There also may be some older js mod players that don't use webaudio. Anyway I guess it's in the realm of possible, but unless someone makes it usable from C2 I guess this info isn't useful.

    Well, Gigatron is our module genius, but his implementations all use webaudio, like you say, it seems possible, R0J0hound but I'm totally (as you'd imagine) useless with proper code, so I haven't a clue how to implement such a thing. Maybe it would be possible to take Protracker https://www.scirra.com/forum/plugin-protracker_t129409?&start=40&hilit=MOD or something, and convert the webaudio parts to javascript and just send the output to html5 or something?

  • The idea isn't super difficult but i guess explaining it with text and implementing it is tricky.

    1. we first need to know if the player is colliding with a tilemap. This is dead simple with one event.

    2. we need to know what tiles the player is overlapping. This example here does that:

    viewtopic.php?f=147&t=123332&p=877612&hilit=overlapping+tiles#p877612

    3. So now we have a list of tiles overlapping the player. Here's a collection of ideas that search gives to get a rough collision point between two objects:

    how-do-i-get-coordinates-of-span-class-posthilit-collision-span_p983039?#p983039

    Guess one idea would be to get an average of all the tiles and use that.

    Here's an idea to take the example from two and only use the part of the tile that's overlapping:

    https://dl.dropboxusercontent.com/u/542 ... oint2.capx

    works well if the sprite is only slightly overlapping the tiles

    R0J0hound Can this example be modified to work with collision point data on tiles, rather than just the entire tile?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yes. R0J0hound's examples had a TileMap mechanism.

    Trying this:https://www.scirra.com/forum/get-the-x-and-y-of-a-span-class-posthilit-collision-span-span-class_p1025697?#p1025697 adjusting the code to match my car, at the moment it's not resizing the masking box to the size of my car properly, and it's occurring on impact of the tile regardless of the tiles collision polygon, am I missing something?

  • granpa's code (almost) does it (brackets were in the wrong place):

    x=(square1.x+square2.x)/2

    y=(square1.y+square2.y)/2

    Hmm, this doesn't seem to create the sparks at all now, before they created by at the same position as the car, but now they don't seem to be there? I just realized, I'm using tilemaps, so will I need to calculate it for the tile the car collides with?

  • The simplest method would be to use dummy detector objects.

    Sorry, I forgot to ask, is there an efficient way of creating the 4 detectors, and pinning them to the sprite at the different positions?

  • The simplest method would be to use dummy detector objects.

    Yeah, thats what I'm thinking. Does pinning 4 detectors cause a big increase in resources?

  • It's a shame, I'd love to use mods with cocoon, but they only support basic html5 audio. Since html5 audio supports basic playback of samples, is there no way a module playback plugin couldn't do all of it's work without webaudio and just output the playback of the mod file to html5?

  • C2 doesn't give that data. Here are some threads on the topic:

    I noticed, isn't there a plugin that could do it, without using physics? Just to be able to place the spark on the correct side of the rectangle would be good enough.

  • I remember something for two square objects.....x=(square1.x+square2.x/2)...y=(square1.y+square2.y/2) , could be usefull

    Hmm, trying this, it's only creating the spark now and then, not sure mathematically what it's doing exactly?

  • I've been looking through thread after thread and there doesn't seem to be an easy way of retrieving the exact point where two objects (say, a sprite and a tiled background) collide. I want to create a little spark when my car touched a wall, but I want the spark to occur at the exact point on the car body where it hits the wall on the correct side of the car, at the bonnet or rear, etc. Is this possible with just an expression?