00Rez's Recent Forum Activity

  • You can send your .capx to my email address. If you can't reproduce it in a new project, we really can't do anything without your file.

    Ok thanks Ashley. I'll send the project asap. I'll see if I can work around the problem for now. I was going to rewrite the whole thing as it was more of a creative vent and a balance test than a finished product but I don't have time for the competition so I'll have to integrate a pause and restart function then pass it over to Tom.

    Would that be ok?

  • Not really, it was my entry for the competition. It seems to work with new projects <img src="smileys/smiley13.gif" border="0" align="middle" /> so I can't replicate. On another note I did notice when I originally opened the old project (made in r63) into r64 the "Touch" plugin wouldn't show on the object panel or when selecting an event. I had to delete and re-add it. Not sure if this is related.

  • I had a project in r63 which only had one layout named by its default name then this project was opened and saved in r64.

    I then wanted to create another layout which after a key press would go to the original layout. So I renamed the original to "game" then created a new layout named "intro" then it asked if I wanted an event sheet created and I clicked yes. I then renamed the event sheet to "intro events".

    Now I created a simple event in the intro event sheet "if space is down go to layout game". It doesn't work at all. I tried mouse clicking, object clicking, etc. It seem it's failing to go to the game layout and can't.

    Not sure if it's a bug and I'm hoping I'm overlooking something really simple.

  • Do the HTML5 Canvas line commands work inside plugins? I know this might be a stupid question but I thought I would ask before delving...

    E.g. I have an object and this object draws itself as well as a few filled shapes made up of lines (...beginPath(), moveTo(x,y), pathTo(x,y) etc). Is this possible? If it isn't is their speedy alternatives?

  • Hi Rez - I really like what you have done so far and I question whether this can be done even more efficiently without the use of sprites - I wonder if drawing vectors with canvas to create the effect would be better in the end.

    something I looked up

    I don't know if you'll continue to work on this plugin or not - I just wanted to share that link to see if the second example was possible

    I understand there are vector functions for plugins however I noticed Ashley mention about slow down using to many of these. I wanted to leave the rendering to the designer rather than my plugin as this can be used for many different things.

    If I come across a good method I would add it to the plugin believe you me!

    I'll have a look at your reference. Thanks Vile! <img src="smileys/smiley20.gif" border="0" align="middle">

  • bowiz2

    100 - round(min((distance(Sun.X, Sun.Y, Sun.Sight.CurPixelX, Sun.Sight.CurPixelY))/(Sun.Sight.Radius * Sun.Sight.Tilesize),1) * 100)

    This above should work set the LightCell effect to "Destination out."

    Finally, the drop off effect as I've mentioned (the core bit you talk about) is some elaborate maths which at the moment I can't think of, try Google! <img src="smileys/smiley17.gif" border="0" align="middle" />

  • I managed to get it to work somewhat, but instead of being lightest at the center, its darkest. How do I invert it? I think you explained it in your last post, but I still don't really get it. Can you try and explain it as if your explaining to an imbecile?

    Here is the code for the opacity:

    Lightcell--->Set Opacity To min(distance(Sun.X,Sun.Y,Sun.Sight.CurPixelX,Sun.Sight.CurPixelY)/ (10 * 32), 1)*100

    Lightcell--->Set Opacity To 1 - (min(distance(Sun.X,Sun.Y,Sun.Sight.CurPixelX,Sun.Sight.CurPixelY)/ (Sun.Sight.Radius * Sun.Sight.Tilesize), 1)) * 100

    The 1 - inverts the opacity. The Sun.Sight.Radius and Sun.Sight.Tilesize are expressions and if you put them in you don't have to worry about changing them as it will automatically update.

  • When I disable it the radius gets really big, more or less the way I want it, but I didn't get what you said about the set opacity thing. I just copied from the example file. What I understood is that code makes it so that the opacity is set in relevance to its distance from the light source, but only up to a certain distance. Is this right? If so, how can I change what the restraint is?

    The equation I used for the opacity was a quick implementation.

    The radius say 5 is multiplied by the tile size which is default 32. This is the maximum distance at which the opacity would be 100 or 0 depending on how you blend the LightCell/Shadow. You need to gradually decrease/increase this as the distance decreases back to the centre. Plus a realistic light has more of a drop off than a linear reduction in intensity. There is a bit of math involved in producing a realistic light. Experiment.

    Quick and easy way: min(Distance from light to shadow cell / (Radius * Tilesize), 1) this produces a number between 0 and 1. To invert take this number from 1 then multiply by 100 to get a value you can assign to the opacity setting for the lightcell/shadow objects.

    Make sure you snap to the grid when placing the objects or it won't look right.

  • > For some reason when I change the radius, nothing happens. Any ideas why?

    > Oh, and I got it working with your last posts :)

    How and what are you setting the radius to?

    <img src="http://dl.dropbox.com/u/19078872/opacity.png" border="0" />

    Toggle disable this then change the radius to 10 and preview then change it back to 5 and preview. The way you set opacity is the problem no matter how big the radius is the opacity is reduced at a set distance.

  • For some reason when I change the radius, nothing happens. Any ideas why?

    Oh, and I got it working with your last posts :)

    How and what are you setting the radius to?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Can you upload ready example for download?

    I've uploaded this as a behavior in the plugin section for c2 it includes the plugin and example file:

    Grid based sight behavior

  • You can use the Sight behavior expression Tilesize to get the Sight's tilesize which you can also set in the behavior properties. You can use this for cell based calculations e.g.:

    round(Mouse.X/Player.Sight.Tilesize) * Player.Sight.Tilesize

    Grid expressions:

    Sight: Grid

    O Height: Get the height in cells of the field of view grid.

    O Offset: (used but not useful I think)

    O Radius: Get the sight radius.

    O Tilesize: Get the grids tilesize.

    O Width: Get the width in cells of the field of view grid.

00Rez's avatar

00Rez

Member since 26 Aug, 2011

None one is following 00Rez yet!

Trophy Case

  • 13-Year Club
  • Email Verified

Progress

14/44
How to earn trophies