Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,633 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How to keep track of car movements? #361639
03/04/11 07:30
03/04/11 07:30
Joined: Dec 2010
Posts: 9
S
sbaya Offline OP
Newbie
sbaya  Offline OP
Newbie
S

Joined: Dec 2010
Posts: 9
Hi, I am using the free version of A8.
I am working on a driving simulator that teach user how to drive a car? by practical lessons, each lesson contain virtual instructor that will give the instructions.
So, what i want to ask do anyone have any idea how can i do that.
here is an example:
the first instruction is to turn on the car[press m].
if the user pressed anything else nothing happen,but when he press "m" the next instruction appear .
second instruction is to move forward [press w] and then turn right [press d].

I hope that you get what i mean, i want to keep track of the car movement so that when it reach a specific place (by using a specifice key) the program will know and do a specifice procedure .

please help me ...

Re: How to keep track of car movements? [Re: sbaya] #361720
03/04/11 16:59
03/04/11 16:59
Joined: Dec 2009
Posts: 361
R
rtsgamer706 Offline
Senior Member
rtsgamer706  Offline
Senior Member
R

Joined: Dec 2009
Posts: 361
First, have your instruction appear on screen using a string and Text.
I am assuming your camera is already sitting in the car.
Do the tutorial on strings ant text for your instructions.

http://tutorial.3dgamestudio.net/
(workshop #7) if you haven't already.
and tell the string to say your instructions.

Then have your car run an action called controls.
(you can call it whatever you want) and use the following code:

action controls()
{
while(1)
{
if(key_m)
{
//do whatever you need it to do
}
wait(1);
}

with this code you will have text on the screen saying "press the M key to turn on the car"
and whatever you in put the part where I said "do whatever you want"
will happen when they press the M key.

making the text go away when they press the M key is a bit more complicated
so try and get this working, when you are done reply to this saying
you're done and we can move on to the next steps.
Hope that helps

Re: How to keep track of car movements? [Re: rtsgamer706] #361758
03/04/11 21:18
03/04/11 21:18
Joined: Dec 2009
Posts: 361
R
rtsgamer706 Offline
Senior Member
rtsgamer706  Offline
Senior Member
R

Joined: Dec 2009
Posts: 361
Sorry, I just re-read your post, I guess I misunderstood what you needed.

I'm not sure what you mean exactly by "track movements" but I can probably help you.
You can track movements by either having invisible block and when the car hits them your next instruction appears.
or you can use variables that increase or decrease as the car moves forwards or backwards
and your instructions appear when the variable reaches a certain value.
If that's not what you mean please tell em what you need. Hope that I can help
Rtsgamer706

Re: How to keep track of car movements? [Re: rtsgamer706] #361869
03/05/11 16:23
03/05/11 16:23
Joined: Dec 2010
Posts: 9
S
sbaya Offline OP
Newbie
sbaya  Offline OP
Newbie
S

Joined: Dec 2010
Posts: 9
thank you.
yes, that's what I meant,I also thought of using (x ,y ) coordinates, but did not know how to write the code (because i am a beginner).
So, if you can write a basic function that will do what you said earlier,please do...



Last edited by sbaya; 03/05/11 16:25.
Re: How to keep track of car movements? [Re: sbaya] #361880
03/05/11 17:17
03/05/11 17:17
Joined: Dec 2009
Posts: 361
R
rtsgamer706 Offline
Senior Member
rtsgamer706  Offline
Senior Member
R

Joined: Dec 2009
Posts: 361
Firstly just for the record I'ma beginner too! (I've only been doing this for about a year)

you're right that you could just do coordinates so here are your options:

variable method:

action car()
{
var place = 0;
while(1)
{
if(place == 100)
{
//whatever you need it to do here
}
if (place == 350)
{
//whatever you need it to do the second time here
}
wait(1);
}
}

for this option you would have the variable increase whenever the care moves forwards on its route.
(This method will only work if you either have a set route that the person can't stray from
or you want your instructions to appear after a certain amount of movement or time)

position method:

action car()
{
while(1)
{
if (my.x == 100)
if (my.y == 250)
{
//do whatever is needed here
}
}
}

this method is pretty easy but it will take you a while to figure out what coordinates you need
and you'll probably want to do a range so they don't have to hit an exact point.
ie. instead of

if (my.x == 100)

//you would have

if (my.x >= 50)
if(my.x <= 110)

that way they would have to hit some place within those coordinates not one exact pixel.

Alternatively you can do the third method which is distance code and boxes:

have an invisible passable box at your "coordinate" and tell your car if it is within a certain distance from the box do whatever is needed.
This code is a bit more complicated so if you chose this method please tell me and I'll give you the code then.
Keep in mind all this code is untested so you may have to fiddle around with it to make it work perfectly.
The numbers I put are just examples change them to what you need.
hope this helps
rtsgamer706

Re: How to keep track of car movements? [Re: rtsgamer706] #361913
03/05/11 19:58
03/05/11 19:58
Joined: Dec 2010
Posts: 9
S
sbaya Offline OP
Newbie
sbaya  Offline OP
Newbie
S

Joined: Dec 2010
Posts: 9
Thank you so much ,i appreciate your help...

Re: How to keep track of car movements? [Re: sbaya] #361982
03/06/11 02:59
03/06/11 02:59
Joined: Dec 2009
Posts: 361
R
rtsgamer706 Offline
Senior Member
rtsgamer706  Offline
Senior Member
R

Joined: Dec 2009
Posts: 361
You're welcome
Glad I could help.


Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1