R0J0hound's Forum Posts

  • Prominent

    It's the same as far as I know. The browser could cap the fps, but I don't know since I've only ever used 60hz displays.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Giganten

    It should, although I'm not sure if "fps" will have a good value at that point. You could wait a second or so first first.

    Just leaving the timestep at 1/30 means if the refresh rate is 120 the physics will run twice as fast than if the refresh rate were 60.

  • remy-jay

    How are you using pathfinding? That line just moves the Sprite. So does the pathfinder but maybe it messes things up when manually moving a Sprite while it is following a path. I'm not sure.

  • This may help:

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

    This creates a shadow sprite for each object of the family.

    The shadow keeps track of the uid of the object it's paired with and how high it is, which i call "z".

    Then to move the objects I just move the shadow and put the objects's position to (shadow.x, shadow.y-shadow.z)

    For the jump I added another variable to shadow called "vz" which is just the vertical speed. Then I use the following to make it accelerate down due to gravity (400) but stop when z is 0. The result is a nice parabolic motion.

    every tick:

    add 400*dt to vz

    set z to max(0, self.z+self.vz*dt)

    Then to make it jump just set vz to -300 or something.

    You could change it up to move the shadow instead of the object. ( shadow.y=object.y+shadow.z )

    Just be sure to change the object's y when the z changes.

  • It's running smooth enough here with chrome. I used to get some pretty serious jank with firefox so I switched browsers. As far as I can tell the reason for the jank has to do with the rendering portion of the browser when a graphics card isn't supported well. Which is the case for my machine with all browsers.

    Here's a sinple js test I made a while ago to see how smooth motion can be in the browser:

    In chrome I get a slight variation in frametime but it's not terrible. Still it can be distracting to the eye.

  • It's used in BASIC, SQL and probably others.

    != is more common and is used in c, Python and JavaScript off the top of my head.

    Some languages even use something different like ~= in Lua.

  • Badmiracle

    Ok here's a capx how to do it.

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

    The idea I posted was on track but was flawed.

    For tilemaps, it's enough to move the area you want to paste onscreen and move the paster by the same amount.

    For particles that wouldn't work as moving particle objects doesn't move the already spawned particles. The solution was to save the particles position when it was created then move it to the center of the screen.

  • Savvy001

    You should be able to do it by pasting the Sprite into the canvas then pasting a another sold Sprite that covers the paster object. The second object should have the destination out blend and just change the opacity to lower than 100. You'll also want to make the second object invisible when not pasting.

    The only caveat is it never fades all the way to transparent, although it gets close.

    Badmiracle

    No eta for a fix. I haven't touch the plug in a while.

    The particles off screen aren't drawn so the only workaround I can think of is to move both the particles and paster object on screen before pasting.

    Here's the offset.

    Offsetx = particles.x-scrollx

    Offsety = particles.y-scrolly

    Subtract it from the partircle and paster positions,

    Paste the particles,

    Then add the offset again.

  • I'm on my phone but would using mouse.x(layer) help? That should give a the mouse position on a layer. If you just use mouse.x it just uses the first layer which is the hud usually.

  • If you're using the physics behavior there is an expression for mass and X an y velocity which you can combine to get the speed with distance(0,0, vx, vy).

    If using another behavior then most have an expression for velocity or speed as well. Or if you'd like to calculate the speed with events you can if you keep track of the old position of the object.

    Every tick

    Set text to distance(Sprite.x,Sprite.y,oldx,oldy)/dt

    Set oldx to Sprite.x

    Set oldy to Sprite.y

    Outside of the physics or chipmunk behavior's an object has no mass so there's nothing to calculate.

  • If you're getting it from php I'm guessing you're using Ajax or something to get it. In which case you can just set the indexes of the array with Ajax.lastdata. No manipulating of the text required.

    My solution above is if you're typing the above json in directly.

  • I'm guessing you're referring to when you can pick new objects.

    New object's do exist instantly, but here's info on what's happens with regard to picking new objects:

    It's basically do to how the object filtering works in the event system. The question is how to implement it better.

    Maybe having the ability to make lists of objects. It would be a bit tricky when dealing with destroyed objects though.

    I'd like to think the whole event system could be overhauled to be simpler and more powerful. I've been trying to come up with a design that addresses things like picking two separate instances and this toplevel thing in a simple way. Imo a good design is key before I make argument how I think things could be better. Maybe eventually I'll find that holy grail of perfect simple design.

  • Use the browser object to run some javascript to set a var to the json and access it that way or use yann's json plugin.

    The first step for either is to convert the text into a valid c2 string of text. Partially covered here:

    Let's use the browser object method. The first step it to convert that json text to both a valid C2 string of text and valid javascript.

    1. paste your json text in notepad

    2. replace ' with \'

    3. replace " with '

    That gives some valid text you can put in quotes and C2 will be happy with as input.

    Next use the browser object's execute javascript action to set a variable to the json.

    "window.myjson = {'Row':[{'id':'1','Item_Name':'Bushfly','Image_Path':'Monsters/Bushfly.png','Quantity':'1', 'Description':'It\'s a Monster.','Seller':'Mr. Garrison','Star_Cost':'1','Category':'Monster'},{'id':'2','Item_Name':'Jebbie','Image_Path':'Monsters/Jebbie.png','Quantity':'1', 'Description':'','Seller':'','Star_Cost':'1','Category':'Monster'}]}"[/code:1t778izg]
    That sets a global variable "myjson" to the json.
    
    Next use the browser.execJs() expression every time you want to access a value.
    browser.execJs("myjson.Row[1].Item_Name")
  • JSON's are just text and text can be stored in an array if that's what you're asking. If you get the text from a dictionary you can just store it in the array with the dictionary.asJSON expression. If you want to store the text directly you have to change all the " to "" or ' and then put quotes around the whole thing.

    Either of these are valid c2 strings of text:

    "{""c2dictionary"":true,""data"":{""id"":""1"",""Item_Name"":""BushFly"",""Image_Path"":""h.png"",""Quantity"":""1"",""Description"":""Monster"",""Seller"":""Garrison"",""Star_Cost"":""1"",""Category"":""Monster""}}"
    [/code:honoehc0]
    [code:honoehc0]"{'c2dictionary':true,'data':{'id':'1','Item_Name':'BushFly','Image_Path':'h.png','Quantity':'1','Description':'Monster','Seller':'Garrison','Star_Cost':'1','Category':'Monster'}}"
    [/code:honoehc0]