Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (581)
games submitted by our members
Games in WIP (500)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Game Play & Game Design / Re: How to drive on a road? on: 2006-01-14 00:16:43
Hi.

I have got some help in another forum.

Where someone wrote the following:
Can someone please comment if it seams like the way to do it?

Quote
Hi Thome, welcome abroad...

I'm no expert but I have an idea to solve your problem..
what you need is AnimatedSprite class or AdvanceSprite class from GTGE for the road...
oh my bro solar, don't scare us with 3D stuff here Laughing , there you go you scared Thomas already...Laughing


yes the road basically is just like a triangle, in my mind there are minimum 6 frame for the road
animation. (the more frame the road has, the more smooth the animation)

the first 2 frame is for the straight road, called it A1 & A2
the different between A1 & A2 is the size & the position of the short stick & the center stripes you
mentioned, so if you animate it , the car just like moving forward. use this method in GTGE:
Code:

getAnimationFrame.setDelay(...)

with this mehotd you can set the car is going fast or slow. It only update the animation for the road

more faster or slower.
the 3rd & 4rd frame, called it A3 & A4 , is turn left road, just make the 2 curve line to the left so
it appear like a road, and give short stick & center stripes with different size & position, the more
it appear closer offcourse the more big the size of the short stick & the center stripe, so when you
animate it the car just like moving forward.
you can quest the last 2 frame right... it just like the 3rd & the 4rd frame, but only curve to the
right.
using AnimatedSprite or AdvanceSprite you may choose for the turn left or turn right behaviour you
like, between moving the road sprite or just simply moving the car sprite.
also you can manage the colision between the car with boundary(short sticks)
with AnimatedSprite class you can set which frame is currently active using method :
Code:

setAnimationFrame(0, 1) //straight road
setAnimationFrame(2, 3) //turn left road
setAnimationFrame(4, 5) //turn right road

say it you are using Timer class to manage when the road going to turn left or right ...you can use the

action method :
Code:
 
if(timer.action(elapsedTime)){
   setAnimationFrame(2, 3)
}

there you go the simple way to create car simulator in 2D
if you don't understand or confuse with my explanation, please don't be hesitate to ask.
and for anyone who understand what I'm talking about, especially solar Razz , please help me for explaining more detail.
2  Game Development / Game Play & Game Design / Re: How to drive on a road? on: 2006-01-12 18:25:49
Should I make the stripes like 2D objekts that appears at the horizon, grows and disapears out of frame?
And pinpoint them to the road object so the stripes always is in the middle of the road. Somehow?
3  Game Development / Game Play & Game Design / How to drive on a road? on: 2006-01-12 16:59:14
HI.

I have problem finding out how to program my carsimulator.
The game should be very simple. You sit in the car and therefor only see the road as a triangle from the bottom of the screen to the horizont. When you stear with the arrows on the keyboard the triangle (road) should move. When the road moves the center of the road moves to the sides.

That shouldn't be hard to do. But what do I need? Should I use java3D?

The hard thing with the road is the stripes in the middle of the road that makes us undrstand that we are moving forward. How do I do this? On each side of the road there is going to be short sticks that also make you see that we are moving forward on the road.

Please help me get started. What I want to know is what ways there is to do this.
 
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (63 views)
2014-04-15 18:08:23

BurntPizza (61 views)
2014-04-15 03:46:01

UprightPath (74 views)
2014-04-14 17:39:50

UprightPath (57 views)
2014-04-14 17:35:47

Porlus (75 views)
2014-04-14 15:48:38

tom_mai78101 (100 views)
2014-04-10 04:04:31

BurntPizza (160 views)
2014-04-08 23:06:04

tom_mai78101 (255 views)
2014-04-05 13:34:39

trollwarrior1 (208 views)
2014-04-04 12:06:45

CJLetsGame (215 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!