Flashlight demo in projects
Shri

Waders,

 

This is a near duplicate of a post in: 'How to use Wade' - Flashlight effect.

 

With a little help form Gio, I put together a little demo of how to make a flashlight effect with wade

It is up on the projects page - Flashlight Demo

 

A few general things to note:

  • I can't seem to turn the tank unless I run the demo in full screen mode.
  • The night effect is just a purple rectangle - I just filled an image in photoshop with the color at 50% opacity
  • The flashlight is just a white triangle(ish) shape - you could play around with this shape / color to get different light effects.

 

In the code:

  • The message layer is a lower number than the dark layer which is lower than the game layer. If you understand wade layers then duh, if you don't, go read about wade layers
  • The dark layer resolution factor is set to 0.1. To maintain performance but I'm not sure how this would perform on a mobile.
  •  If using destination-out in the composite draw function, the nightEffect sprite has to be behind  the flashlight sprite. In other words, the order of the sprites on the layers matter. Refer to the diagram near the bottom of this page,   html canvas  to understand how the composite draw functions make foreground and background images interact

 

Anyway, this could be a nice easy effect to add to your games.

 

cheers,

Shri

All 3 Comments
Shri

Gio,

 

I found an error I made in the demo.js file, so I removed the file.

When I tired to upload the new file I got "Upload Unsuccessful.... User Limit exceeded"

Not sure what to do to fix it, the demo will not work now since the main js file is not there ?

 

help ?

Shri

Gio

Hey Shri

 

There is a default limit of 10MB per user on the projects you can upload to our server, just so people don't abuse it. We trust you and don't see any reason why we wouldn't be able to give you more space. However, I didn't write that code and honestly have no idea where to find this limit in the database. I'm having a look and will update you shortly.

Shri

All,

 

The demo is up and running again, refer to the note above for additional information.

 

cheers,

Shri

Post a reply
Add Attachment
Submit Reply
Login to Reply