Coding suggestions


Here’s a bunch of suggestions for new functions for the coding.


gotoRandAndPlay(frame) - quite literally goes to a random frame in the project and plays from there
gotoRandAndStop(frame) same as above, but stops at the frame


code x and y are different from the project x and y, so make them both the mid-point of the object.
clone - make them more understandable, they’re so confusing
show() and hide() - show and hide the object
hitAny() - returns true if the object hits anything, or if it hits any of whatever is in the parentheses
hitAll() - true if it hits all the items listed
notHit() - true if it doesn’t hit anything, or whatever is in the parentheses
a bunch of more hitTest scenarios

I’m bored… lets go to sound before i close this off.


stopSound() - stops a specific sound.

sorry this is kinda weird and abrupt…



Some of these seem like great ideas to me!

Some feedback:
The gotoRand functions would be a little unnecessary imo
since you could just put a random number inside the regular function.

var rn =Math.round((Math.random()*10)+1);

Or, you could quite easily make that function yourself:

gotoRandAndStop =function(obj,min,max){

var rn =Math.round((Math.random()*max)+min);


For show and hide, what would they do exactly?
Would it just make the object visible and invisible?

I REALLY like the hit any/all/not hit function idea.
That would literally be so helpful.
I know there’s ways to reproduce similar results, but having
a quick and easy way to test against all other objects would be
so convenient to have!

Also, being to stop a single sound is a feature I feel should have
been added a while ago. It’s almost a necessity.

Great ideas! :+1:



For the random thing, I see what you mean, and I think you’re right. Probably not that useful. Show and hide makes them invisible and visible, like you asked.

1 Like


I think these are some great suggestions, and we’ll definitely be taking a close look at them as we keep working on the code editor.

For the Object functionality, we’re hoping to add in a bunch of new hit detection and potentially some physics engine functionality as well!

Also, it seems that in addition to what you’ve suggested, we might need some easier to use math functions. stuff like random() or min and max as opposed to relying on just the Math library might be useful.

I personally enjoy the math functions provided by the P5.js library, and think that modeling off of their style might be really valuable! (



These are good ideas. I noticed a couple more that would be redundant, though. notHit is the same as !hitAny(). (The ! means “not”.)
Show and hide are the same as Clip.opacity = 0 (or 1).
Also, Wick already includes helpful Random functions so you don’t have to make your own. :slight_smile:

I think the hitAll and hitAny could be useful but potentially hard on performance, since it means multiple hit tests. However, once Wick has a tagging system for objects, you could ask if an object is touching any object with a certain tag, which might be faster than asking about specific objects.

Also, I agree it would be great to see other hitTest modes! Like testing if a point is touching a line/Raycast, or if a bounding box is touching the actual shape of an object, or any other combination. (Some of these are slower than others! For example testing the exact shape of an object is slower than testing a point, and Flash devs knew this.)
Wick could even go the Construct 2 route and let you make collision polygons instead, which makes the hitTest simpler for the computer and therefore faster.