Sumyjkl's Forum Posts

  • Hey everyone

    Attachments are superbugged and I can't seem to post my project file.

    So recently I have been trying to make a very simple tilemap based terrain checker, that goes through all the tiles and makes them have slopes and blends and things. This is the second try. This time I'm using am array to store the actual tile locations and make changes, and the tilemap is only there as a collision mesh and to look good. Hopefully.

    The problem

    For some reason, the fact that I have two material types (stone as 0 and grass as 1) screws it over somehow, and I have no idea how. The effect is that every time the system checks a grass tile, it converts it to a stone tile. Or in other words, as shown by the sprite text object says, (tells which material ID is under the cursor) there are no instances of the grass material, even though I put them there in the tilemap.

    The issue I believe is somewhere in here:

    [attachment=0:2lbn83g5][/attachment:2lbn83g5]

    To explain the system I have in place, the tilemap sprite is set up to have 20 tiles each row, so I can just pick say, tile 20 and it will be the 2nd type of terrain, and will be a 1 in the "tilelist" array (zero based).

    I probably should have done it the other way and had 1 through 20 as materials with 21+ being versions of those materals, but that shouldn't really matter too much here.

    If you have any ideas I would love to hear them.

    Thanks,

    Sumy

    Edit

    Fixed; I redid the tilemap so that it was based of 1 through 20 rather than 0,20,40,60 etc. and it seemed to work fine after that. Must have been a math problem, like rounding errors.

  • You can just use the random function and floor it, but if you want to make random shapes, that would be more difficult. Adding random tiles to random locations is easy though.

    For example:

    tilemap > set tile at

    X: [int(random(tilemap.width)/{put tile dimensions here})] to {whatever tile}

    Y: same as above but using tilemap.height

    To remove tiles you just do the same thing, but with the 'erase' action.

    To make certain shapes you would have to make a whole bunch of rules for where tiles can go, and then use repeat loops or something similar to check each tile in an area for those rules, or something like that.

    ...Or ask someone who knows more than I do about random generation.

  • eli0s the good thing about adding these as triggers rather than using conditions is that it would help improve performance as well, because triggers aren't checked every frame.

  • I just tested this and there are some issues that I'll point out but you can actually use focus for textboxes to enable the virtual keyboard.

    Unfortunately the keyboard then affects the scaling of the project, and thus - at least in Firefox - making the whole program scale down enough that it is unreadable. This can be fixed by changing the scale mode to crop, but we all know we'd rather not use that for several reasons.

    [attachment=0:2xgg4akz][/attachment:2xgg4akz]

  • The most simple solution is to add a text box where you have the last score. That text box then gives a value in the array that corresponds with the last score. You'll have to make sure that the names part of the array is pushed down as well though. Not sure if you can do anything about what it looks like, but you might be able to set you're own text box up with events otherwise.

    As for the CD, I am unsure as to whether that is possible. Usually you can't write to CDs and saves are stored in the browser. Otherwise you could just save them to a text document that would always be with the game.

    Edit: Another useful note to make, you can change the text box look by placing the text box outside the canvas and then use a focus event when you click on your actual text box.

    Edit: And unfortunately for some reason the textbox must be visible on screen for it to do anything...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • After rotating what? Generally setting angle to 0 works pretty well for that.

  • codah, it might be more useful to supply them.

    Like this, or like this which is more helpful thanks to

  • You can just move toward position. A formula could be used also to slow down over time.

    For example (just a guess): move toward (x,y) distance of: distance / 200 or sqrt(distance)

    Apart from that, you would need to use move at angle, with an angle starting from self, ending at the target location: angle(self.x,self.y,target.x,target.y)

  • If you are using physics, you can just apply force towards position on the objects. Recommended that you put them all in the same family first though.

  • As for the wheels, it's as simple as don't use pin behavior. Unfortunately it conflicts with physics. For a wheel though you can just set a physics joint (it's an action). You can try with the different types of joints, that should fix any conflicts.

  • I tried what I said before and it worked. Are you thinking of something different? What they were talking about in that thread was parabola movement, not 'recoil'.

    Here's an example:

    on mouse clicked:

     ・ create object "cannonball"

     ・ apply impulse 1 to cannonball at angle(cannon.x,cannon.y,mouse.x,mouse.y)

     ・ apply impulse 1 to cannon at angle(cannon.x,cannon.y,mouse.x,mouse.y) + 180

    This works with some changes to the mass of both objects.

  • In theory if your objects have the correct mass, you can just apply the same force on the cannon as the cannonball, but at the opposite angle.

  • Usually you need to port-forward to host on a PC, but I'm not sure how that applies to C2. If you can find the ports required (probably in the MP tutorial by Ashley) you can sign on to your router and allow that port. Otherwise you're IP is basically not going to work. I don't really know much about the multiplayer in Construct, but I'm pretty sure that applies to anything. It would explain why it only worked on LAN and Hamachi too.

    I would suggest looking up how to port forward for your specific router. That could be far more specific and helpful than I.

  • If all else fails a workaround could be to store your initial X Y coordinates, and move at random angle a random distance every frame that it makes a particle. Then again, there might be a less finicky and more optimized way to achieve the same effect.

    [attachment=0:1b8fks8i][/attachment:1b8fks8i]

  • As for the first problem, if you aren't using a server, make sure you're portforwarded and everything; that is likely to be the problem if you haven't.

    The lag is probably (I'm basing this entirely on logic because I have little hands-on experience with netcode) caused by setting the peer position based on the "send input to server and retrieve" way of doing multiplayer. Best to avoid that as much as possible and just say to move to where the player now is, or move the peer to where the server thinks it is only sometimes.

    Not sure how much sense that made. Maybe someone else can clear it up.