Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 07-30-2003, 06:20 AM   #1
The_Seademon
Registered User
 
Join Date: May 2003
Location: Down Under
Posts: 11
Default scrolling track, top down racing game

I have a dilemer, im making a top down racing game and ive hit a wall.
Ive got all the coding for moving the car and collision detection, ie the car is working perfectly. My problem is the track, the track i have dosent fit on the screen. I need a way to scroll the track around as the car moves. I dont want the car to stay in exactly the same spot, ie moving the track rather that the car.


onClipEvent (enterFrame) {
carx = getProperty("/car1", _x);
cary = getProperty("/car1", _y);
if (carx < 100) {
trackx = getProperty("/track", _x)
trackx = trackx + w
setProperty ( "/track", _x, trackx )
}
if (cary > 400) {
tracky = getProperty("/track", _y)
tracky = tracky - w
setProperty ( "/track", _y, tracky )
}
if (carx > 400) {
trackx = getProperty("/track", _x)
trackx = trackx - w
setProperty ( "/track", _x, trackx )
}
if (cary < 100) {
tracky = getProperty("/track", _y)
tracky = tracky + w
setProperty ( "/track", _y, tracky )
}
}
this is the code i have so far, it kinda works but i need a way to stop the car going of the screen, the tracks moves but the car keeps going. varible W is the rate at which the car moves.
Any sugetstions would be greatly appreciated.
even a totally diferent approach would be fine.
Thanx Alot
The_Seademon is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:17 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.