Looking for a little clarification on tweens and groups.
I defined my group within my create() function like so
enemyGroup = this.physics.add.group({
defaultKey: 'dFlap',
maxSize: maxNumEnemy
})
I then use a timed event to trigger a callback function named “scaleOverTime” which throws an error Uncaught TypeError: Cannot read property ‘add’ of undefined
function scaleOverTime (enemyGroup) {
if (enemyOnScreen && !killDragon) {
this.tweens.add({
targets: enemyGroup,
scaleX: '+=.2',
scaleY: '+=.2',
duration: 1000,
ease: 'Sine.easeInOut',
delay: 0,
paused: false,
repeat: 3
})
}
}
Ironically I use a similar approach (tween) to handle killing my enemies - and that works
function killEnemy (enemyGroup, killZone) {
if (canAttack && killDragon) {
this.tweens.add({
targets: enemyGroup,
duration: (600 + 1280) - enemyGroup.x,
ease: 'Sine.easeInOut',
y: 1380,
alpha: 0,
angle: -100,
delay: 0,
yoyo: false,
paused: false,
repeat: 0,
onStart: function () {
enemyGroup.anims.stop('dragFlapAnim').setFrame(6)
enemyGroup.setTint(0xff0010)
enemyGroup.body.setEnable(false)
enemiesKilled = enemiesKilled + 1
killDragon = false
//camShake = true
//shakeAmt = 400
},
onComplete: function () {
enemyGroup.destroy(enemy)
}
})
}
}
I have been searching the forums here and on html5gamedevs.com for a way to apply a tween to a child of a group.
Here it states groups can’t be scaled or positioned :
html5gd forum post
Curious to know if this in fact true?
If so, I would assume if I can’t affect the group, I should be able to affect the child of said group?