View Full Version : My first JavaScript...

04-02-2003, 08:26 PM
I would like to make a web page that will show the results of a battle for a game I'm working on.

The page would have some small .jpgs that need to move around to replay the actions and movements of characters in the fight.

Can I use javascript to move images on the client display this way?

If so is there already a script that does this kind of thing or can someone give me an example of the code to use?

04-02-2003, 08:59 PM
Well, your question is a bit vague. To give you a short answer, yes it can be done.

As far as how to do it, well, that's a project-specific task.

04-02-2003, 09:01 PM
Agreed. I do, however, have a rudimentary Animation class (http://www.peterbailey.net/dev/jsclasses/) you can use.

04-02-2003, 09:16 PM
Oh my... So now extenal javascript files are being refered to as classes? This is not looking very friendly for people that don't know the difference between java and javascript (me being one of those with no java compiler or experience with it). Is that all they are? Fancy naming? Or does javascript also have classes as a real name for something?

04-02-2003, 09:18 PM
No... constructors are being referred to as classes - because that is quite close to the truth, and it's a familiar concept for anyone used to other object oriented languages, that doesn't work through the prototype-based inheritance. (In fact prototype-based inheritance can fully emulate class-based, while the opposite isn't always true.)

04-02-2003, 09:42 PM
Right, I happen to have it saved as an external file, but just being an external file doesn't make it a class.

A class is basically a way to group data and the logic that processes that data together into objects. Grouping them meaning encapsulating them from the rest of your code (which could be other classes)

04-02-2003, 10:02 PM
So you mean that if I make my own collapsing menu script and make it all externally for means to be used as a common gui on my site, I may as well call it a class? Or is it much more?

04-02-2003, 10:13 PM
No, you may not as well call it a class. A class is in reference to creating custom javascript objects that do a specific task. Look at the source code for any of my javascript classes and you will see they are all built roughly the same. A constructor function with prototyped methods. There's nothing creating, handled, or otherwise manipulated outside the object. THis is the basis for a class, and as liorean pointed out, that is a familiar term for objects done like this.

04-02-2003, 10:23 PM
I'm confused, I'm sticking with regular javascript stuff. I never even learned constructor stuff. And I can't upgrade to Internet explorer 6 without a good internet connection since microsoft doesn't have a redlist download for it. The most up to date version I've ever found distributed on a cd was Internet explorer 4. And their support sucks, I'm pissed at them.:mad:

04-02-2003, 10:27 PM
Ask a friend with a faster connection or something to download it...

<http://browsers.evolt.org/?ie/32bit/6.0> (~70 MB, so it's not small)

04-02-2003, 10:27 PM
More info for those trying to help (thanks bty!)

I have top down pictures of a landscape.

I can track a players movement in game (Neverwinter Nights) and save those locations to a database (MySql).

What I end up with is a log of locations at different points in time of where players and bad guys are.

What I am trying to do is output that info to a webpage using PhP to pull the data from the database.

I can get all that raw movement data into the webpage,
now what i need is to use javascript to make some jpgs move over the map the way my players did.

I hope this answered some of your questions. If not ask and I will try again.

04-02-2003, 10:38 PM
No, I can never win. My computer is a compaq. They scam people. So far, my computer is less than 3 years old and it has a broken modem, broken cd-rom drive, broken hard drive, incompatible sound card, and stubborn mouse. My old DOS computer that is older than I am is in better shape, flawless. So there's nothing I can do. I can't even get a new one because I don't know the first thing about credit cards.:(

04-02-2003, 10:42 PM
Oh, you don't need a credit card - you can open the box with a regular screwdriver ;)

Then you just put in an old harddrive that one of your friends has discarded because it was too old - and see to it that your friend has put IE6 on it.

(At least that's how it often works in the student world, for those that can't or don't want to buy new stuff.)

04-02-2003, 10:51 PM
no, everything on that machine is either dead or close to it. I need a whole new system and I can't even get a checking account let alone a credit card.

04-03-2003, 02:20 AM
To tails:

1. Why can't you get a checking account? Have someone you trust (like a parent, perhaps) open it with you?

P.S. This shouldn't be in this thread, if you have further comments along those lines please post them uhh (no Webmaster Pit... sigh) ... perhaps the Computer/PC issues forum? Although I can share your frustration considering my somewhat troubled past (don't ask!).

2. Build your own computer (old compaq computers used proprietary hardware, that's why they stink - you couldn't upgrade them!).


04-03-2003, 09:57 PM
I just turned 18, but my mother lost my birth certificate. So I can't work, can't get a driver's liscence or even a permit, can't make a dime doing anything. I've got the maturity and dependency of a 13-year old because of how irresponsible she is for losing stuff. And I've been on her back for 2 months, daily and nothing happens.