Discuss Scratch

treehitta
New Scratcher
1 post

need help with wheelie game bike switching

I am new to scratch and have just started on my first project: https://scratch.mit.edu/projects/1229068062 but need some help on a bike switching button, in my game you wheelie a dirtbike and you can do tricks using the number keys and the costumes change, I am wondering how I can get this to happen for another bike and wish to have a variety of bikes in my game using different costumes and all bikes to have a unique set of tricks, does anyone know how I can achieve that?
RokCoder
Scratcher
1000+ posts

need help with wheelie game bike switching

I would use costume names so that you could choose costumes according to bike make and trick name. You would end up with something like -

switch costume to (join (join (bike model) [ - ]) (trick name))

This makes it easy to share tricks for different bikes. You can also have unique ones for each bike, of course. You can even check if a costume exists for a trick by using something like -

switch costume to [empty v]
switch costume to (join (join (bike model) [ - ]) (trick name))
set [_trickCostumeExists v] to <not <(costume [name v]) = [empty]>> // will be true if it exists, false otherwise

Powered by DjangoBB