codah's Recent Forum Activity

  • Glad you have a solution. I prefer instance variables as they don't pollute the code and can be used more easily for picking. By all means share your solution.

  • There's probably MUCH better ways of doing this but something that comes to mind is that you could divide the track into zones, and each zone would have a range of directions (angles) the car is allowed to have, and if it's outside of those angles then it's going in the wrong direction. For example in the track you showed us, the left side of the track would restrict the car to angles 180 to 360 (or whatever). The right hand side would be 0 to 180, etc. To know which zone the car is in you could use invisible sprites that cover each zone and do an overlapping test with that sprite and the car, or check x,y coordinates to determine which zone the car is in.

    Another thought is that if the driver is collecting checkpoints in the wrong order, you'd know they are going in the wrong direction.

  • You could do System: 0 < array.at(1) < 3

    Actually I'll have to remember to use this more often myself. I know it's really meant for decimal values but it's a nice shortcut.

    BTW you could merge lines 2, 3, 4 into one line and 5, 6, 7 into one line as well.

  • ok so stick with the different sprites.

    Put the sprites in a family

    Spawn an instance of the family (which spawns a random sprite from the family)

    Do what you want with it..

  • This gets asked a lot Have a search around you'll find ideas.

  • The Toggle-switch behaviour might be useful too.

  • You're saying 'drag and drop' but that only requires 1 mouse click, not two. Can you clarify what you actually need?

    edit: anyway try this. A 1-click option

  • Thanks codah - I have quite a few of those blanks in my code and you're right.

    I used to prefer blanks, until the first time I got some conditions deleted and I didn't notice. Can create very hard to find bugs. So I'm a convert but others will have their prefs Also I think I saw it recommended by Ashley once.

  • I wouldn't leave it empty, I find it best practice to put an 'every tick' (or maybe a Trigger Once) instead. One reason is that conditions can sometimes get deleted accidentally/inadvertently (when deleting an object), and you won't know if it's one of those or an intentional blank.

  • No problem. You wanted to select a different 'non repeating' random number for the animation frame whereas your code was just choosing from 0-3 each time and so could repeat. With mine you have a list of numbers that it chooses randomly from, and that chosen number then gets removed from the pool of available numbers for next time. Not sure what the While loop was for in your code, and choosing numbers twice... so I didn't go into that much The other thing is you can just set animation speed to 0 so you don't have to 'stop animation'.

  • Because if you just do 'on keyboard pressed', you're not picking any objects. Actions work on picked objects. If you don't pick any specifically in an event then all of the object type are picked. So in the case of 'key pressed' the condition doesn't pick any balls so they are all picked by default, and you get all the balls destroyed, whereas in mine I've picked the one touched/clicked on.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ashley I think he wants to have the timed autosave as well as the 'on preview' autosave.

codah's avatar

codah

Member since 30 May, 2014

Twitter
codah has 1 followers

Trophy Case

  • 10-Year Club
  • Email Verified

Progress

11/44
How to earn trophies