Search found 78 matches

by ilovelove2019
Mon Dec 09, 2019 5:57 am
Forum: Support and Development
Topic: How to use local variables in games properly?
Replies: 4
Views: 4468

Re: How to use local variables in games properly?

You simply declare everything that doesn't needs to be globally accessible as local. That's it. Pass around values through function arguments if you need to. Making local duplicates of global variables helps with performance (but they don't track global variable changes). Don't go nuts with generat...
by ilovelove2019
Mon Dec 09, 2019 5:54 am
Forum: Support and Development
Topic: How to use local variables in games properly?
Replies: 4
Views: 4468

Re: How to use local variables in games properly?

Ye, the game code doesn't needs to be good, it just needs to function.
by ilovelove2019
Sun Dec 08, 2019 10:34 pm
Forum: Support and Development
Topic: How to use local variables in games properly?
Replies: 4
Views: 4468

How to use local variables in games properly?

Hello everyone, I just learned how to program games, when I encounter bugs, I often ask the community for help. Some people have read my code and they say there's a lot of instability, it's about me abusing the global variable. They advised me to use as many local variables as possible because it he...
by ilovelove2019
Sat Nov 23, 2019 2:38 pm
Forum: Support and Development
Topic: How do objects in the game work properly with the time that the game runs?
Replies: 5
Views: 3882

Re: How do objects in the game work properly with the time that the game runs?

Do I need to multiply self.vx, vy for dt? I see bump already in the user guide already. function movePlayer(player, dt) local goalX, goalY = player.x + player.vx * dt, player.y + player.vy * dt local actualX, actualY, cols, len = world:move(player, goalX, goalY) player.x, player.y = actualX, actualY...
by ilovelove2019
Sat Nov 23, 2019 1:14 pm
Forum: Support and Development
Topic: How do objects in the game work properly with the time that the game runs?
Replies: 5
Views: 3882

Re: How do objects in the game work properly with the time that the game runs?

I say many of those objects are my tilemap, I build a full map, it's the platform blocks that collide with players and other objects, those blocks are static, I don't know if they count as affecting performance. or not? Besides, about jumping, I find it only fails when the number of objects appearin...
by ilovelove2019
Fri Nov 22, 2019 10:36 pm
Forum: Support and Development
Topic: How do objects in the game work properly with the time that the game runs?
Replies: 5
Views: 3882

How do objects in the game work properly with the time that the game runs?

Hey guys! I am making a platform game with bump. I encountered a situation with my method of jumping. Each time the player presses 'w' the character will jump (I put self.vy = -370), and in the Player: update (dt) function I have the command that if self.vy <200 is self.vy = self .vy + 20. Because I...
by ilovelove2019
Thu Nov 21, 2019 10:11 pm
Forum: Support and Development
Topic: How to calculate physical stats for a platformer game
Replies: 10
Views: 6529

Re: How to calculate physical stats for a platformer game

Yes, it is also a very effective solution. Now I realize that, for simple platformer games, you should not use windfield because it is quite complicated and unnecessary. In your experience, which physical library should I use?
by ilovelove2019
Thu Nov 21, 2019 4:04 am
Forum: Support and Development
Topic: How to calculate physical stats for a platformer game
Replies: 10
Views: 6529

Re: How to calculate physical stats for a platformer game

Reasonable. Your answer is very detailed, I took out my calculator, paper and pen and thought about it, each of your explanations, it was like a lecture, very rewarding. I agree with the use of 'applyLearearImpulse'. And now I have to handle the x speed, when the player holds the key, the speed incr...
by ilovelove2019
Wed Nov 20, 2019 10:47 pm
Forum: Support and Development
Topic: How to calculate physical stats for a platformer game
Replies: 10
Views: 6529

Re: How to calculate physical stats for a platformer game

Yes, I am trying. My game doesn't need physics to be complete, I just need it like some popular platformer games today. I think I will leave the default of one meter equal to 30 pixels. I want the character to jump 3 times in height. So I have to fill in the computer of ivan the jump height is (24/3...