View Single Post
XxMoNsTeRXM XxMoNsTeRXM's Avatar

JCF Member

Joined: Sep 2013

Posts: 191

XxMoNsTeRXM is doing well so far

Jan 9, 2015, 11:36 PM
XxMoNsTeRXM is offline
Reply With Quote
Quote:
Originally Posted by Primpy View Post
Ok, I obviously made a mistake, but I don't know where did I go wrong. I just tried to add the "Fall Damage" and "Wall Jumping" snippets. Argh, I don't even know how to modify two scripts.
Code:
int jumpKey = 0;
int fallTimer = 0;
const double maxFallTime = 4;
 
void onMain() {
  jjPLAYER@ p = jjLocalPlayers[0];
  p.ammo[2] = 3;
  if (p.keyJump == true) {
    jumpKey = jumpKey+1;
  } else {
    jumpKey = 0;
  }
 
  if (jjMaskedPixel(p.xPos + (p.direction * 13), p.yPos) && p.keyJump == true && jumpKey < 3) {
    p.ySpeed = -10;
    p.direction = p.direction * (-1);
    p.xSpeed = p.direction * 5;
//    && p.ySpeed < 0
  }
 
  if (jjMaskedPixel(p.xPos + 13, p.yPos)  && p.ySpeed > 0 && p.keyRight == true) {
    p.ySpeed = 1;
    p.alreadyDoubleJumped = false;
  }
  if (jjMaskedPixel(p.xPos - 13, p.yPos)  && p.ySpeed > 0 && p.keyLeft == true) {
    p.ySpeed = 1;
    p.alreadyDoubleJumped = false;
  }

 int fallTimer = 0;
const double maxFallTime = 4;
 
void onMain() {
    if (!jjMaskedPixel(p.xPos, p.yPos + 32) && p.ySpeed > 0) {
      fallTimer++;
  } else if (jjMaskedPixel(p.xPos, p.yPos + 32)) {
    int repeats = (fallTimer / 70) / maxFallTime;
                if (fallTimer >= maxFallTime) {
    for (int i = 0; i < (fallTimer / 70) / maxFallTime; i++) {
        p.health = p.health - 1;
        if (p.health < 0) p.health = 0;
    }
                }
      fallTimer = 0;
  }
    if (p.health == 0) {
        fallTimer = 0;
    }
}
AngelScript reminds me a little bit about LUA, but LUA was slightly easier, or at least on Roblox. Don't judge the Roblox players, it takes a lot of time to do a decent game and you need to know both modeling and programming...
Well... you got 2 "void onMain()", you gotta put both snippets into one "void onMain()", that might be the problem. I remember I did that too and I was like "Why isn't it working?", the chatlogger didn't give me any errors, and I realized I've got 2 of them.
Also you declared the variables "fallTimer" & "maxFallTime" twice.

(I moved this reply from the JJ2+ Thread to this thread)
__________________
~XxMoNsTeR