R0J0hound's Recent Forum Activity

  • Interesting. So the on timer event is more a fake trigger since it picks all the done triggers at once. I think I’ve seen that before but honestly I seldom use that behavior.

    Anyways, the on timer and on game pad press are more exemptions to the rule than consistent with what most other things do.

    I guess the manual could be more explicit about it but I’d wager it’s more an oversight than anything.

    I think I found out about those things with some tests when helping someone debug something that wasn’t working correctly. It’s mostly a subtlety that’s not always an issue.

  • Besides using browser.log() you can use sprite.pickedcount to see how many objects are picked.

    In general I assume most triggers just have the one relevant object picked at a time. “On created” for example will be run for each object you created. So no for each needed in triggers.

    Ultimately the plugin/behavior could be made to pick multiple instances at once but I can’t think of any examples. Are there any that don’t stick to the standard?

    Triggers are like functions, they will be jumped to. But there is something called a fake trigger that’s used sometimes that looks like a trigger but is run in place.

    “Keyboard: On key pressed” is a trigger.

    “Gamepad: on button pressed” is a fake trigger, which is the same as:

    Game pad: button down

    Trigger once.

  • If the tile size is 32x32 you can do it with the following. Basically the horizontal distance plus the vertical one. It’s called Manhattan distance after the city.

    int(abs(Player.x-goal.x)/32)+int(abs(player.y-goal.y)/32)

  • For the view, you just need to change the 3D camera angle. But if I pick this up again at a later date it can be made to have a different sloped ground and direction of gravity to make change the view of the dice.

    To have two dice? Hmm... right now it’s not very modular. One way would be to clone all the object types and make the cloned instance have the same values in the instance variables. Then duplicating all the events and using the replace object feature to make the duplicated events use the cloned objects.

    Even then the two dice won’t interact with each other without further collision code.

    In general I just need to revisit this eventually and make it more modular.

  • Nice to know C3 added that expression to the keyboard.

    Looking at my example again it can be simplified a bit by replacing:

    int(tokenat(widths, Function.Call("find",c),","))

    with:

    SpriteFont.CharacterWidth(c)

    I completely missed that. Will update the example shortly.

    Edit:

    example updated.

  • I skimmed that blog article. It certainly in an in depth list, but most of what we are doing here is just enough to do what we want. We aren't intending to make a comprehensive editbox.

    dop2000

    I like that example. Very console like. I noticed you have the same issue as I got where you can't type a "?". Anyways, the solution I came up with was to add an event listener in js that calls a construct function with "e.key" which is what key was typed taking into account shift and capslock. At least in C2 the keyboard object wasn't enough to get that.

    document.addEventListener('keydown', (e)=>{c2_callFunction('keyDown',[e.key]);});

    Here are some tests. The first hides the textbox by setting the css opacity to 0, and draws the text with the text object.

    uc9fb6ebcabf90859c2a22d78c4f.dl.dropboxusercontent.com/cd/0/get/Ch_YBhM1kTlCChejNm1D_uSs-cE5HxZf3H7s805Kf1mW9Unljl4-7rEiLpdUrlqWgYyAv37i_yXr5Xj0ilSItThbSJ1XcvkiAtHr2tZs0btX5X1mJEwxF5zNWLM1KEws4bdWv7oj6ThZo-vrlO1WfspU/file

    Here's another test that uses spritefonts with variable widths. It supports single line text and lets you type with any character in the spritefont. Clicking sets the cursor position and you can remove charters with delete and backspace.

    uc52572204bb7a69e2b1b789c9c3.dl.dropboxusercontent.com/cd/0/get/Ch_F5IGNUfZAfI35VvnnCobHAsOeJzhD_6deBkiMR5Qra6_LV-AWJJfeVyMnNlW5aKVPOKicEUlEEz_c9knV5lI-rM6ZD189K9o_iPgNbmgJdzHy6wiE19WN8-eaVGExCkjO3tdWEYmq5NoAk1gdNims/file

    Taking the idea further to support highlighting, ctrl moving between words, copy/paste, double click selecting words, and multi lines just require a bit more work but seems possible.

    Issues i encountered were the needing to get the keyboard input with js as mentioned above, and find() was case-insensitive, so I had to make a case sensitive one with a function.

    Here's how the spritefont was generated:

    construct.net/en/forum/game-development/tools-and-resources-27/spritefont-generator-168408

  • I agree with dop, there are pros and cons to making your own text input vs just using the editbox.

    To me, editboxes work well but you are limited how it can look, even with css. Making your own can go from fairly simple like dop’s example to trying to reproduce everything. Clipboard access is the tricky part in js.

    Another idea is to hide the editbox by setting the style opacity to 0. That would let you interact with the editbox but let you draw it as you wish. It’s just fiddly to make them match.

    As long as it works it should be fine. I’ve seem lots of games and software that don’t just use a normal os editbox and it’s seldom an annoyance.

  • The “trigger once” is throwing it off. Basically they all need to not be frame 1 before the event can run again.

    I’d do the logic under a “on frame changed” condition.

  • The tilemap has some expressions you can use to get that. Namely the row and column of the tile at a certain xy. Then you can use another expression to get the xy of the tile at a certain column and row. That will give you the tiles center then you can get the sides by adding/subtracting half the tile width/height.

    But you can calculate all that directly. For example if the tilemap is at 0,0 with a 32x32 tile size, and the player objects are smaller than 32x32, then this will give you the bounding boxes of each of the tiles the player could be overlapping.

    Gridx= int(player.x/32)

    Gridy=int(player.y/32)

    For i=-1 to 1

    For j=-1 to 1

    Tile at (gridx+i,gridy+j) != -1

    — left = (gridx+i)*32-32

    — right=(gridx+i)*32

    — top=(gridy+j)*32-32

    — bottom=(gridy+j)*32

    — resolve collision

  • An alternative if no one has the add-on is you can manually remove all references to it from the capx.

    Capx files are just zip files and you can access the .c2proj and .xml files for the layouts and events to remove it from them.

  • Wouldn’t setting the layout scale, as you would to zoom in with normal 2d games work?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here's an idea how to make the bullets meander a bit before reaching their target.

    Basically this gradually increases the turning force, and uses sin() to meander in a curvy way. All the numbers in event 4 can be tweaked to change the effect in various ways.

    ucf62846b85de8f36836332f5efb.dl.dropboxusercontent.com/cd/0/get/Ch8a3IG-6dJWBSZ6x1T7IjI3JHAr1iLglOD834JmfSJPpmMzBln3pDrx3RE1dObtKOZ9fZoHcEq2rwdTvOv3KVj-5qEHOhR774q1Cry49M558R7iWrx8_mh0qyqaA5EaZWknFfI70v5VrvETtWxyR9FD/file

R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 155 followers

Connect with R0J0hound