View Single Post
jjturbo9

JCF Member

Joined: Mar 2025

Posts: 6

jjturbo9 has disabled reputation

Mar 24, 2025, 12:18 PM
jjturbo9 is offline
Reply With Quote
Thanks a lot!! I will try this code now. I wonder why you have to write player.xPos and player.yPos though. Seems irrelevant to me, what am I missing?

I just tried it but I don't hear the sound yet. To be extra clear about what I try:
When Jazz (or another) walks through the event 'Trigger Zone 21 | onoff 1 | switch 0' the sound COMMON_ITEMTRE has to be played. But only the first time he walks through it, I don't want the sound to trigger every time, only when the thing is triggered the first time. But I think that would be the case automatically anyways?

I just copy/pasted the first code you send in my AS file where the other AS code already worked. And replaced 66 for 21, but when I trigger the thing I don't hear anything. I already checked if I wrote COMMON_ITEMTRE correctly and that's not the issue...

Code:
//Sugar rush counter
bool onDrawLives(jjPLAYER@ player, jjCANVAS@ screen) {
    screen.drawSprite(590, 45, ANIM::PICKUPS, 1, jjGameTicks>>2, -1, SPRITE::NORMAL);
    screen.drawSprite(580, 30, ANIM::PICKUPS, 13, jjGameTicks>>2, -1, SPRITE::NORMAL);
    screen.drawString(570, 15, "SUGAR RUSH", STRING::SMALL, STRING::PALSHIFT, 16);
    screen.drawString(600, 35, formatInt(player.food%100, "1") + " / 100", STRING::MEDIUM, STRING::PALSHIFT, 16);
    return false;
}
//Sound effect for getting key
void onFunction0(jjPLAYER@ player) {
  if (!jjTriggers[21]) {
    jjTriggers[21] = true;
    jjSample(player.xPos, player.yPos, SOUND::COMMON_ITEMTRE);
  }
}
I'm curious what the issue is but I have no idea tbh. Hope you can help At least the original code still works even with this code in it, previously when I added non-working code the sugar rush counter stopped working too.

Last edited by jjturbo9; Mar 24, 2025 at 12:32 PM.