logan-r / vilify

Unleash Your Inner Mad Scientist and Destroy the World (with Ice Cream) in this Open Source HTML5 Game
http://logan-r.github.io/vilify/
GNU General Public License v3.0
32 stars 25 forks source link

JS Files Question #84

Closed AMPITUP closed 10 years ago

AMPITUP commented 10 years ago

Ok, I went through ALL the files here to understand what was going on. There was one or two spots in the JS that I didn't get what was going on, but, then again, I am not very familiar with CreateJS. Anyway, it looked like there were nearly all the features implemented. I downloaded the .zip file, and nothing at all works. Just out of curiosity, why is there so much code (that I couldn't find any errors in, not that I really looked hard or anything though), and no working features? Sorry about my ignorance, but I just kinda wondered why nothing worked and what needs to be done (coding-wise) that I might be able to do.

Mektrode commented 10 years ago

Thats the very same question ive been asking myself for a while now.

Alex notifications@github.com wrote:

Ok, I went through ALL the files here to understand what was going on. There was one or two spots in the JS that I didn't get what was going on, but, then again, I am not very familiar with CreateJS. Anyway, it looked like there were nearly all the features implemented. I downloaded the .zip file, and nothing at all works. Just out of curiosity, why is there so much code (that I couldn't find any errors in, not that I really looked hard or anything though), and no working features? Sorry about my ignorance, but I just kinda wondered why nothing worked and what needs to be done (coding-wise) that I might be able to do.


Reply to this email directly or view it on GitHub: https://github.com/HTML5-Games/vilify/issues/84

AMPITUP commented 10 years ago

The main contributors are Logan and sru (I think), so I just thought that they might be able to give me a job or at least give me a hint at what is going on.

sru commented 10 years ago

It works for me. You might have cross domain issues because modern browsers prevent people from loading images while opening locally.

You need a simple server that can serve directories. For example, you can do:

python3 -m http.server
python -m SimpleHTTPServer

with Python 2 and 3.

sru commented 10 years ago

And please ask when you have doubt about what each part does.

AMPITUP commented 10 years ago

Ok, well, what are you saying works? The whole game, or just part. Cuz, on the Vilify site, I get slightly more than what I get if I download and run locally, but there are still no images or working stuff. Oh, and I didn't really understand what you meant by the python thingy.

sru commented 10 years ago

I mean that it does what it should do. We've been implementing parts of the game, so it might not look finished/polished. On the Vilify site is outdated version of the game.

If you just click the html file and open in browser, it says XMLHttpRequest cannot load file://path/to/file/images/logo.png. Cross origin requests are only supported for HTTP. So, you have to use server to serve the whole Vilify directory and open the html file via localhost:8080 (or whatever port you use for localhost server).

AMPITUP commented 10 years ago

So, I open the file in my browser and then change the url?

sru commented 10 years ago

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Same_origin_policy_for_JavaScript

Read Cross-origin network access.

AMPITUP commented 10 years ago

Ok.

AMPITUP commented 10 years ago

sRy, but that didn't make sense. Oh well...

sru commented 10 years ago

Well, I don't know how else would I explain this...

Modern browsers prevent loading images if you open the html file by clicking on it.

AMPITUP commented 10 years ago

Ok, so then do I open it some other way?

Graeme22 commented 10 years ago

"Well, I don't know how else would I explain this... Modern browsers prevent loading images if you open the html file by clicking on it."

firefox doesnt

AMPITUP commented 10 years ago

^How about Safari?

sru commented 10 years ago

Safari probably does, and Chrome does too.

@Graeme22 I didn't know. Now I know.

logan-r commented 10 years ago

A temporary work around for this issue is to change the first line of objects.json from { to Game.DATA = { and then save the file as objects.js. After that, in index.html, add <script src="game_data/objects.js"></script> after <script src="js/main.js"></script> (line 23).

AMPITUP commented 10 years ago

Oh. Ok. So, I'll fork it and then make those changes to see it?

AMPITUP commented 10 years ago

I tried it and it didn't work.

sru commented 10 years ago

Try opening it with Firefox. According to @Graeme22 it doesn't block loading images. It didn't work for me without using server.

AMPITUP commented 10 years ago

Ok. Will do. Thx.