Jump to content

help with my javascript code


StarTrekCafe
 Share

Recommended Posts

 hi. a blind it student. and need a seasoned javascript coder to help me out and look at my code, to see if it is right, and works, okay, if not, then suggest how to improve. can any one help me out. marvin. ps: totally blind, using a screen reader jaws for windows,http://www.freedomscientific.com using  windows 10, 64 bit pro, got visual studio community edition 2015, and using notepad, and using external images, audio, etc. now, need to get the me speak.js, and also what extra human voices, doing a audio based space invaders game, for the blind, multi player, and play over the internet. can some one help me out, just to point me in the right direction. marvin. ps: from Adelaide, Australia.

Link to comment
Share on other sites

Hi Marvin, I don't think you'll necessarily get offers to mentor you but if you post your almost working code somewhere public (preferably such that it can be tested in browser) and ask for more specific advice, for example: "I am trying write a function that does X but I don't think it's working because my code does ... when I ...", then you are likely to receive help here - the more effort you put in (eg. stripping your code down such that it just tries to do the one thing you are having problems with; running it through a Javascript beautifier if you are not sure it is visually well formatted) the more likely people are to want to help.

 

The HTML5 Web Speech API is still very new and experimental but why not consider using that if you need full text to speech? Or alternatively, pre-record samples of all the speech you need - as imagine the latter will incur less lag, which might be important for any game that is not turn based.

P.S. I don't have much experience with games for the visually impaired, but I would have thought positional audio cues might be better than speech for a game based around shooting moving targets. The HTML Audio spec includes positional audio so it may be a possibility as long as you don't need to target the likes of IE11 and can deal with browser quirks such as not being able to trigger a sound that it not in response to input.

Link to comment
Share on other sites

no suggestion of the problems you have or where you are stuck (what does or doesn't the code do vs. what is intended), 1800 lines of code which appears to be almost entirely (unattributed) copy-pasted code from various sources (eg. https://github.com/mariohsieh/galaxian-shooter-example/blob/master/js/shooter.js http://blog.sklambert.com/html5-canvas-game-2d-collision-detection/ ), no use of libraries, spelling mistakes that the browser / debugger will find for you (eg.  ctx.roatate ), 99% graphics code in what is implied to be an audio only game...

 

I'm not going to help. I probably wouldn't have spent much time myself on this further anyway, but I'm not interested in digging though that at all... much less downloading that and patching a bunch of images in just to see it run.

 

EDIT: I suspect the criticism may sound harsh and for that I am sorry. I suspect modularising you code and keeping it trim might help you to keep the project in your head... you're writing a space invaders clone - you don't "need" a quadtree or other spatial partitioning system. Instead of trying to take code and assimilate it, start small - write simple modular code you can test and debug - an enemy class that has a log() method that output's it's state to the console or to the page (this applies even if you are partially sighted enough to see enemies onscreen) if you can't understand your code or explain whether or not it's even working, don't expect others to (if fact if you're serious you may write a spec - and then code to it)

 

Use tutorial code sparingly... a tutorial might help you to understand the way a space invader might move both relative to the level and to other invaders, or understand one approach to structuring your code, but don't copy and paste the code - instead take the understanding and adapt and fit it into your project (write code in your own words, like you would an essay, variable names, methods, loops, comments should make sense to you; steal ideas and knowledge not code, and when you do resort to borrowing code to save time and get something working then always add comments attributing where you got it and who wrote it/it belongs to)

 

As your code appears to contain simple typos, you will need a way to catch such issues. Don't ask people to find issues that should be obvious. If debuggers are difficult (you'll still need to use them though!) you might want to look at a compilation step to catch more errors upfront, this might mean working in ES6 and transpiling to ES3/5 or you might even look at other languages that are designed to compile to Javascript such as Dart, CoffeeScript and Typescript.

If figuring out if your code is working or not is arduous due to your sightedness, consider writing testing code. In the AAA games industry I've heard of testing even using technologies such as OpenCV machine vision library for automated unit testing, but simple tests might consist of scenarios like checking that a space invader with state A and position A' can move to location B' (or possibly within some proximity to B' if you're using floating point and/or no trival movement/state-machines) in X time steps, or testing border cases of whether a projectile should or shouldn't hurt the player object.

Link to comment
Share on other sites

hi. okay, was just looking for help, okay, did not copy and paste, did type it up, and then trying to learn, just to see if i was on the right track. if you are not willing to help me out, fine, will go and find another forum, see if i can get help, not to do it for me, but to see where i am going wrong, and how to do it better. thanks for your help. marvin.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...