Boothand Posted October 5, 2014 Posted October 5, 2014 Try it out! Do note, the AI is a very bad loser.http://tiny.cc/winandforswinn In any case, has anyone in here ever done Javascript? The game is kind of broken by the bad collision detection once the ball speeds up. If you look at my code (right click the page and 'View page source'), do you see anything that could be done to avoid it skipping past the collision? Edit: Woops, forgot all the //comments are in norwegian, if someone tries to navigate the code.. DarthValeria and gerbilOFdoom like this
eezstreet Posted October 5, 2014 Posted October 5, 2014 JavaScript is pretty bad for doing games in, try Flash or Java if you're interested in doing web games.
afi Posted October 5, 2014 Posted October 5, 2014 I'm not sure what's supposed to happen but when I click on "start game" nothing happens Sithani likes this
Circa Posted October 5, 2014 Posted October 5, 2014 Nice! It was a bit laggy on mine but it could be me. Well done for your first! Boothand likes this
IrocJeff Posted October 5, 2014 Posted October 5, 2014 The paddle on the left started moving faster when the ball would go towards it. Also, the ball ran out of steam for me and basically just stopped somewhere on the bottom of the screen. Pretty good for a school project, though. Boothand likes this
Boothand Posted October 5, 2014 Author Posted October 5, 2014 It's expected that everyone's gonna have different results. For me, the ball always lags through the opponent at higher speeds. A friend of mine says it never bugged through, and he even had trouble winning.. JavaScript is pretty bad for doing games in, try Flash or Java if you're interested in doing web games. Yeah, it's not very pleasant (mouse coordinates... brrr!). Using Javascript because we were supposed to, and we've just started the programming course. I'm not sure what's supposed to happen but when I click on "start game" nothing happens Hmm. What browser are you in? If you have Chrome, that should work... The paddle on the left started moving faster when the ball would go towards it. Also, the ball ran out of steam for me and basically just stopped somewhere on the bottom of the screen. Pretty good for a school project, though. Yeah, that's intended. It does an idle thing while waiting, and when it *sees* the ball half way back, it has a max speed that it tries to stop the ball with. To avoid it running out of bounce, use boostfields©™ to make it go faster (also the only way to beat the computer). Edit: Haha, even though I've tried supporting different window sizes, playing the game without the browser in full size makes the AI move wayyy faster and messes up.. stuff. That's also a major facepalm when it comes to games in JavaScript.
Bek Posted October 5, 2014 Posted October 5, 2014 I have no idea what happened when I won. Boothand likes this
Didz Posted October 5, 2014 Posted October 5, 2014 The Start button doesn't work for me either in Firefox. JavaScript is a nice language for writing cross-platform games for the web. Some examples: 2048, Untrusted, and some games by Enclave Games. Here's a simple game of Space Invaders being live-coded in 30 mins: http://vimeo.com/105955605 Boothand likes this
Ramikad Posted October 5, 2014 Posted October 5, 2014 Same here, the start button doesn't work (Firefox). Also, in case you're interested (if I remember correctly) and are sick of typing the "/", you can simply use <script language=javascript>.
Boothand Posted October 5, 2014 Author Posted October 5, 2014 Thanks for those links, @@Didz! Very useful. What annoys me the most is things like, it seems to be a whole lot of trouble to get the accurate mouse position, and if you change the layout of things in the HTML for example, the mouse will be offset once again, after using ugly code to manually align it by eye-measure. Same goes for general behavior of objects when using a smaller window (which in my case also resizes the canvas to fit). As a result, I've had to divide everything by the width of the potentially varying canvas to get the same behavior on different monitors or if people happen to use a resized browser window. I guess somewhere along the way, that went wrong though, and now the game goes crazy if I'm playing it in a resized browser window
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now