R0J0hound's Forum Posts

  • This should work I think. It lerps between the start and end in a straight line. Then also moves in a parabola.

    dropbox.com/s/ilxsoyy7mmm04dc/jump_path.c3p

  • Here’s an idea to keep track of the total rotation of the an object. You’d want it to run toward the end of the event sheet after anything that rotates the sprite.

    The equation used is a signedAngleDifference, which is like the angleDiff() expression but it gives positive and negative for clockwise and counter clockwise rotation.

    Global totalRot=0
    Global prevAngle=0
    
    Every Tick
    — add angle(0,0,cos(sprite.angle-prevAngle), sin(sprite.angle-prevAngle)) to totalRot
    — set prevAngle to sprite.angle

    So a front flip would be if totalRot>360, and a back flip would be if totalRot<-360.

    In general the number of flips could be calculated with:

    Flips = totalRot>0?floor(totalRot/360):ceil(totalRot/360)

    You’d probably want to reset totalRot to 0 when you first get air born from a jump I’m guessing.

  • Something like this would work well. Key differences to what you're doing is it adds to instead of sets the rotx variable. Also instead of the touch speed expression here we find the xvelocity since that gives a direction in addition to speed.

    global rotx=0
    global xvelocity=0
    global px=0
    
    on touch start
    -- set px to touch.x
    
    is touching sprite2
    -- set xvelocity to (touch.x-px)/10
    -- set px to touch.x
    
    every tick
    -- add xvelocity*dt to rotx
  • That library doesn't look to be using 3d. Just rotation and some shading.

    Anyways, I had the idea to do a cloth simulation to do the page turning. Works pretty well when it's stiff enough, maybe with some slight jiggling. But it does let you drag the page like a sheet of paper.

    dropbox.com/s/hrzwjyr7y0erwt7/verlet_page_turn.c3p

    I didn't come up with a nice way to do two sided pages like dop's examples. Maybe it could be doable by offsetting a second page by the vertex normals.

    Multiple pages would need more work. I thought someone else made a working page turn example before, but all I could find were old dead links. Oh well.

  • Yep. Use that all the time. It only doesn’t work when dealing with values between instances of the same type, but I guess that’s a general event problem.

  • You do not have permission to view this post

  • Currently construct uses numbers and strings as values in expressions. Any other type: Boolean, dictionaries, arrays, etc.. are manipulated via actions and expressions. For example the Boolean expressions effectively converts to numbers. Anyways, it’s not alone in doing this, clickteam products do or did this (haven’t used them in a while).

    The closest we got to another value type was immutable arrays in construct classic. You could specify an array like {1,2,3} then store it in variables, or index them with someNumber. You couldn’t change them after they were defined though. It was prone to crashing but was interesting.

    It would be nice to have arrays and dictionaries as variable types too. Mainly to avoid having to deal with picking and to possibly make things look cleaner.

    What’s being suggested here are structs, which would be a nice way to group values. Currently we can kind of do that with sprites with instance variables, or a dictionary with a fixed set of keys. The sprite is better than the dictionary method because the expression editor will catch typos at edit time. Both aren’t ideal because they have to be picked. Picking is fine with simple cases but often we end up having to do juggling with how things are picked to access and modify things.

    The json object is an improvement since you can have as many arrays and dictionaries in it as you like. You still have to pick it, but that’s usually fine since you can get away with a single instance. The main downfall of it is if you make typos in the json paths you won’t know until running it. But I guess that’s the nature of dynamic data structures, you have to check at runtime.

    Structs are nice because you define it at edit time and the editor can catch a typos you make before the game runs. You wouldn’t have to worry about something silently returning 0, or having to check the browser console for errors.

    Anyways just some thoughts.

  • This plug-in only has one light. There currently isn’t a way to add more.

    After the last update the plug-in was at the point it needed a rewrite to support more things. I haven’t had time for such a project in a while though.

  • Your link is asking for a login to open. I was curious to see what kind of json you were trying to parse.

    I’ve only used the object once with the set json action and get expression. The path is roughly the same as accessing values in JavaScript. Had to reference the docs to figure that one out.

    Anyways json maps directly to JavaScript data. The json object is just an alternate way to access things.

    I haven’t dealt with how you loop over arrays or keys yet so I can’t comment on how straightforward that is.

  • Probably should work if you retype the quotes. By default my phone uses different quotes than construct uses.

  • This is how you’d use that or operator in an expression:

    System: pick MapInOutCheck by comparison: (MapInOutCheck.TypeChecked = "ULDR" | MapInOutCheck.TypeChecked = "LDR" | MapInOutCheck.TypeChecked = "UDR" | MapInOutCheck.TypeChecked = "ULR" | MapInOutCheck.TypeChecked = "DR" | MapInOutCheck.TypeChecked = "UR" | MapInOutCheck.TypeChecked = "LR" | MapInOutCheck.TypeChecked = "R" | MapInOutCheck.TypeChecked = "" )
    = 1

    But for something like that I’d utilize the find expression. The list of values are comma separated with commas before and after, and we surround the variable value by commas and find it in the list.

    System: pick MapInOutCheck by comparison: find(“,ULDR,LDR,UDR,ULR,DR,UR,LR,R,,”, “,”& MapInOutCheck.TypeChecked&”,”)>-1
  • Description

    I have been intrigued by a technique for drawing text from a texture using SDFs (signed distance fields). Typically text in construct is drawn to a 2d canvas then moved to a texture which is drawn. Any time the text or font is changed the texture gets updated. SDF text is more like spritefonts. You have one texture atlas and letters are just drawn with quads. SDFs differ slightly from spritefonts in that they can be resized and still have crisp edges.

    Test

    Here is the initial test. I used a tiledBg as the texture atlas, and to draw individual letters, and I used the alpha threshold effect to treat it like an SDF. It compares the text object to sdf text to basically a spritefont text.

    dropbox.com/s/j8hvj98c0nsd0fo/sdf_font.c3p

    The sdf could look better with some antialiasing but that would require a new effect.

    Tools used to make test

    I used this tool to generate the texture atlas and json of the letter metrics.

    evanw.github.io/font-texture-generator

    I also made a small tool to modify the texture to work with the alpha threshold effect.

    dropbox.com/s/2hz7crpwwncr1ny/bw2alpha.c3p

    Multiline text and scrolling test

    I added word and character wrapping to limit the text to an area. I also added basic vertical scrolling. Characters aren't drawn outside of the area and are clipped when halfway in it.

    dropbox.com/s/67ukw6bak4gvq41/no_dom_text_scroll.c3p

    It works but it gets slower the further it scrolls down since it has to process all the text up to that point. I may research how that's usually done. One idea is to process the word wrapping once and add all the newlines in. Then it would be simpler to access particular lines so the scrolling would take the same amount of time regardless. There are some other issues that have come up that I'll work on later.

    Summery

    This is mostly for me to learn about how to do text rendering from scratch. I find it fun that it's possible to do with basically just a texture and a bunch of quads.

    -cheers

  • I seem to recall that type of inventory being made before a few times.

    Here's one idea I just made.

    dropbox.com/s/rwuhpdoblzx3joo/inventory_idea.capx

    Here's an older one with odd shapes.

    dropbox.com/s/tpwx74fq1c43auc/Fit_shapes_into_slots.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think most engines that support multiple exports are designed around that from the start. Construct is designed around browser tech so all its exports either are bundled with a browser or use the browser included with the platform. Since making their own browser isn’t feasible their only option is to hope sufficiently feature full browsers become available on all platforms.

    What construct’s exports do do is still helpful. They bundle your game up into one place.

    Porting houses take different approaches. They mostly convert events to c++ equivalents, but when the events rely on browser features it’s probably something they have to often manually address. I do recall one porting house does have their own tool to convert JavaScript to c++, but again they have to handle any access to browser features case by case. I’d guess they are able to port maybe 90% of the game automatically and over time they may accumulate more reusable solutions to the rest.

    After that they help with some optimizing for the given platforms. They also deal with the console companies as a middle man. Companies such as Nintendo require you to sign an NDA to even get a hold of an Sdk to even develop for their platform. There’s probably some per console tweaks that are needed for various reasons. There’s probably a lot more to it than meets the eye. Also the porting houses will be lagged behind any new versions of construct so that’s a fair amount to keep up with.

    Overall I’d say Scirra already has its plate full with all its current endeavors. The porting houses already port games in general and are familiar with most export platforms. Scirra would have more risk involved as it would take a lot of time to get up to speed and maintain comparability with the different platforms to do the ports in a similar manner.

  • That would work. Kind of what I was thinking. The only thing is mouse sensitivity makes no sense when clicking. At least to me. I’d expect where I clicked to be where I clicked.

    What behavior is the op trying to go for? He didn’t explain much.

    Sensitivity could work for click swipes.

    Global number px=0
    Global number py=0
    On left click
    — set px to mouse.x
    — set py to mouse.y
    Left mouse down
    — sprite: set x to self.x+(mouse.x-px)*1.1
    — sprite: set y to self.y+(mouse.y-py)*1.1
    — set px to mouse.x
    — set py to mouse.y

    I guess you could take that idea with mouse lock too.