peteblank Posted April 8, 2020 Share Posted April 8, 2020 I'd like to create a function and be able to call it in another function. this one specifically function coins(coin) { coin.setBounce(1); coin.body.setGravityY(300); this.physics.add.collider(coin, platforms); this.physics.add.collider(player, coin, collectCoin, null, this); coin.setVelocityX(60); coin.setVelocityY(-300); coin.setCollideWorldBounds(true); } That way every time the coin is created I can call the function for the coin's physics. Link to comment Share on other sites More sharing options...
geocine Posted April 12, 2020 Share Posted April 12, 2020 This is already a function , how are you intending to call it? Link to comment Share on other sites More sharing options...
peteblank Posted April 13, 2020 Author Share Posted April 13, 2020 Well never mind. I'll just copy and paste it every time I create the coin no biggie. I've come across another problem though. I want to use the checkDown(key,[,duration]) method I'm tying to make it so my character waits before it punches every time I press the shift key. Link to comment Share on other sites More sharing options...
peteblank Posted April 14, 2020 Author Share Posted April 14, 2020 never mind, I found about checkDown on the examples page Sorry about that Link to comment Share on other sites More sharing options...
Recommended Posts