Hi scratchers. Ive only been using Scratch for a few weeks, so I've still got a lot to learn.
I have tried making a time trial car racing game (one player) based on the Marble Race game that comes as an example script.
The problem I'm having is that I want to change the stage to the next race track (I have three tracks at the moment) when the car crosses the finish line. I have tried putting an orange spot on the hood of the car and a yellow line at the back of the start/finish line but I can't seem to get Scratch to sense it.
Can anyone help?
Offline
Okay, I think I solved it. I uploaded my updated version here but if you're interested in scripting yourself here's just the description of what I did:
Added a transparent sprite that you pass about midway through all tracks and a variable that detects if you've made it there or not. When you pass the finish line, it knows you're done and that it's time to switch because the variable I made tells it that you've made it to the checkpoint and back to the finish line (So it doesn't say the time repeatedly at the beginning too). So once you finish a race, it resets the variable that tracks if you've made it to the check point, since you haven't made it there this time around yet
Also made the grass have to wait a second after lowering your speed and making a noise, because it got really spastic without a wait
Offline
I think that I'll have a go at making a variable to count laps so that I can tell it to only change tracks once 3 laps have been completed... or would it be better to only change if a target time is reached?
Offline
I think three laps a track is a good idea. Another thing you could do is maybe record all of the times with a list, using the green "join" block to combine a variable that keeps track of the track number with what the timer says. So you'd set the variable to "Track (#):" or something depending on which it was on, and it'd add "Track 1: 36" to the list if you took 36 seconds on track one!
Though that might look a little bulky on the screen, I guess
Offline
Hi! Welcome to Scratch! Here's the way I would do it (assume the finish line is yellow):
Script for Car
when gf clicked forever if (touching color [Yellow] ?) broadcast [Next Track v] endScript for Stage
When I receive [Next Track v] switch to background [Next Track v]Hope that helps! Happy Scratching!
Last edited by shivadas (2013-03-30 21:47:22)
Offline