C
C#7mo ago
Gamer1234556

Monogame Lazer Delay

Hello, I am trying to get a delay to work here but it seems like I am running into problems because either I am getting no delay whatever, or I just don't get the lazer to shoot at all when I press the Mouse Button. Can you please tell me what the problem here is? https://paste.mod.gg/eowefousluca/0
BlazeBin - eowefousluca
A tool for sharing your source code with the world!
13 Replies
Anchy
Anchy7mo ago
it may be your gametime, you are making a new one every update does monogame not have delta time you can pass in when your games update method runs and it updates the rest of the game, pass in the GameTime created by monogame
Gamer1234556
Gamer1234556OP7mo ago
Well when I add in the GameTime in the Update function it gets me the error that there is no suitable method found to override I am not sure what you mean by delta time though, you mean Time Elapsed Well it does have that timeSinceLastShot += (float)gameTime.ElapsedGameTime.TotalSeconds; If that is what you are referring to
Anchy
Anchy7mo ago
yes from what i read, GameTime contains the delta time delta means difference, so the difference in time between frames but you dont want to create your own GameTime, you need to use the one provided by the Update method in your Game class
Gamer1234556
Gamer1234556OP7mo ago
Ok fair enough, I deleted the GameTime and added it to the Update but now I get Error CS0115 'function' : no suitable method found to override
Anchy
Anchy7mo ago
add it to your Unit Update method as well, it needs to go all the way down
Gamer1234556
Gamer1234556OP7mo ago
You mean the base.update() in this case? Well then it gets me Compiler Error CS1501 No overload for method 'method' takes 'number' arguments
Anchy
Anchy7mo ago
did you write this code
Gamer1234556
Gamer1234556OP7mo ago
Wait a sec Ok now I found a new issue
Gamer1234556
Gamer1234556OP7mo ago
BlazeBin - vlqybmyktvva
A tool for sharing your source code with the world!
Gamer1234556
Gamer1234556OP7mo ago
Wait hold on Ok this is my brother's code and he asked me for help But when I couldn't find the solution I decided to ask for help But I guess now I am kind of figuring everything out myself
Anchy
Anchy7mo ago
your replies need to be more detailed
Gamer1234556
Gamer1234556OP7mo ago
Yeah sorry
Anchy
Anchy7mo ago
your brother needs to pass the GameTime instance from the Game Update method through the Update chain from Basic2d, to Unit, to Hero also as a side note, I dont really understand the purpose of the OFFSET Vector2 being passed to Update and Draw
Want results from more Discord servers?
Add your server