• Post Reply Bookmark Topic Watch Topic
  • New Topic

traffic simulator  RSS feed

 
Addie Mustapha
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
okay so i know a little bit of java, and thought I would do a project using jsp, to combine html and java. I also know how to use basic html. I'm doing a program that simulates traffic. I made a table using html that contains two rows and 20 columns. Each cell contains one image of a car(all of the cars are different colors). With the images of the cars on two rows it appears as a street. My question is how would i use java to simulate the moving of the cars. Aka, how do I make a program that assigns the "car images" to different cells, in a loop, oh and how would I change the speed that it does this thank you . Oh and how would I put it on a server.

here's a little clip of the html I did. thank you. Sorry if I seem a bit clueless.
<table style = "background-color:#5C5858;">
<tr>
<td id = "a1" style= "border-left:solid;border-right:solid;"><img alt="" src="C:\Users\All\Desktop\faceup\u1.jpg"></td>
<td id = "b1" style= "border-left:solid;border-right:solid;"><img alt="" src="C:\Users\All\Desktop\facedown\d1.jpg"></td>
</tr>
 
Kumar Raja
Ranch Hand
Posts: 548
2
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Though I have not done this personally before, but I think you can create a motion like appearance, by toggling visible attribute of the image. You can control the visibility and also speed using some kind of javascript. So Ideally, you do not need any java to be used here. You can right some javascript that can be triggered on onLoad event, and you can use loops and etc in the script to achieve this to some extent, atleast. This is my wild guess
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unless you make the whole thing an applet, you'll need to do this in JavaScript, not Java.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!