Looking for opinons.
As title says, I'm just looking for opinons on this code. If it's unreadable (mainly), takes too much memory whatever. (So long as it's helpful of course..)
Take note, i might ask questions. PHP Code:
|
Your styling is quite odd. No offense, but I've never seen horizontally inverted styling like that if you intended it to be that way.
(When I say this, I'm referring to the brackets at the end of the onKeyPressed event) |
Quote:
|
If you don't know how to style your code and want to make it easier for the forum folk to read please use my GS2 Beautifier to clean it up before posting.
The two checks in your key pressed are redundant which also make it confusing in the process. Not a fan of using temp once then not using it through out. You don't really need to evaluate for true/false like that either you could just use but that's ultimately personal preference: PHP Code:
|
I evaluated for true/false because i didn't think there was any other way really. i know another way of making boots but, i wanted to do it in a way i knew i understood completly. which is why its created the way it is.
Edit: thanks for the input though. appreciated. If anyone else got anything they'd like to add, feel free to. I'd appreciate it in advance. |
Quote:
Apart from your coding and the obvious errors your script is kinda alright... You can get rid of both flag toggle lines and just have this.boots=!this.boots though. Just a little shortcut :) |
yeah, that is a shortcut i have known for awhile. but i didn't feel like i understood it well enough, so i used a code i felt like i could call my own. I wanna understand something instead of just using it.
as for temp.key, i used it the way it is because i figured i defined it already. before it was temp.i but i wanted something that would be easier to recognize and key in my thoughts, fit pretty well. lastly, what errors? or were they already pointed out? |
It basically works like this.
By default this.whatever equals null or 0 because you haven't assigned anything to it, It also is a Boolean, which means it can be true or false, eg 0 or 1. So when you put: PHP Code:
|
Quote:
|
You could also short the script by doing something like this
PHP Code:
PHP Code:
PHP Code:
And PHP Code:
PHP Code:
If there are any questions or suggestions about this just ask ^^ |
That one post pretty much summed up everything nicely.
rep+ Edit: You must spread it around before giving it to callimuc x-x |
It's a code that does what it was made to do, but it can be coded and styled in a much more readable and simple way that what you've got there. Well done on the code but snoop around the other posts on this thread and you could pick up on a lot of things.
|
Quote:
PHP Code:
|
Lmao compacting it up as much as we can I see....
|
Quote:
and wow, i never knew what the ?, : meant. but now i believe i do. so to be sure i do. the ? is like saying if(whatever) and the : is like saying 'else'? thanks everyone for the help. greatly appreciated. |
All times are GMT +2. The time now is 05:34 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.