Microsoft MakeCode

Fortnite Game

I need help with this. Please help!!

2 Likes

i can help but right now ima be too busy so i can help in some hours

1 Like

I’d love to! What type of stuff is there going to be? (top-down? guns? heals/meds/shields?

1 Like

ok thanks

1 Like

I am working on adding skins

I need help with some on my code.

here it is:
it says there is a problem in this:

controller.left.onEvent(ControllerButtonEvent.Pressed, function() {
game.splash(“Locker”)
let Locker: 1
})
forever(function() {

if (Locker == 1 ) {

}

})

you cant move

Lets go fortnite

youre not supposed to move

here’s the updated one:

First, you should always put your code between backticks, like this:
```typescript
// My code here
```
Becomes:

// My code here

(The “typescript” after the backticks will make the code syntax highlight)

Next, you should always indent. I can’t tell if you are indenting because you didn’t put the code between backticks. So your code should look like this:

controller.left.onEvent(ControllerButtonEvent.Pressed, function() {
    game.splash(“Locker”)
    let Locker: 1
})
forever(function() {
    if (Locker == 1 ) {
        
    }
})

There are two problems:

  1. The way to define variables is like: let <variable_name>: <variable_type> = <starting_value>. So it should be let Locker: number = 1.
  2. Since you defined Locker inside the controller.left.onEvent function there is a high chance of Locker not being defined in when it is referenced in the forever function. One way to solve this (albeit slightly frowned upon when you can avoid it but whatever) is to use global variables. So you have to move the definition out of the function and put it at the very beginning.

Try to figure it yourself! If you can’t figure it out, here is the solution:

let Locker: number = 1
controller.left.onEvent(ControllerButtonEvent.Pressed, function() {
    game.splash(“Locker”)
})
forever(function() {
    if (Locker == 1 ) {
        
    }
})
1 Like

i used the solution but now my new code isn’t working either, saying there is a expression expected:

let Locker: number = 1
controller.left.onEvent(ControllerButtonEvent.Pressed, function() {
game.splash(“Locker”)
})
forever(function() {
if (Locker == 1 ) {
if (controller.A.isPressed() ()

)
}})

It’s because you didn’t close the if statement properly - it should be something like this:

if (statement) {
   // your code here
}

Solution:

forever(function() {
    if (Locker == 1) {
        if (controller.A.isPressed()) {
            
        }
    }
})

Maybe it would help to do it in blocks and switch to TypeScript to see how it actually works???

Thanks!! Thanks to you, I think i finished my game!!

2 Likes

Wait what are we supposed to do?

Press A to loot. when you press B, if the last thing you got was a weapon, you ambush/raid enemies with it.

but if you keep spamming a you keep getting more and more hearts

I’ts a chance thing. just see what you get!

Yeah, my luck is absolutely bad (it’s literally 75-25 and I’m worried :worried:)

1 Like