Skip to main content
gamedev.net
🔒 Locked

[java] A hopefully basic javascript question

Started by kylecrass Apr 23, 2004 at 9:23 PM 1 replies 250+ views
Original Post
kylecrass
kylecrass
Hello, i am a little new to javascript, but i have been programming in c++ for a few years. i was wondering, i have some code for character movement in my game that id like to put into a class for better reusability and readability. The code works fine as is, but a class would make for better scalability in my project. but classes in javascript are different than that in c++, can anyone help point me in the right direction please? Any help would be much appreciated...and please dont flame me....i need help XD
Koroljov
Koroljov
A class in JavaScript:

function someClass()
{
this.someVar=0;
this.someOtherVar="test";
}

var aClass=new someClass();
alert(aClass.someVar);
alert(aClass.someOtherVar);
Why do my programs never work on other computers?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.