game-development

Formula in JS to create experience goals for different branches in a game

牧云@^-^@ 提交于 2020-08-10 22:13:44
问题 I'm creating a little game in Javascript, and I have trees that can hold a certain amount of max experience, and each tree have a varied amount of branches that also needs to be leveled up with experience, and they should total to the tree max experience. If it was that easy, I would just divide them equally, like max / branches , but since it's for a game, I need to make a formula where the first branch needs no experience, and then each branch experience needed steadily increase (while

Formula in JS to create experience goals for different branches in a game

两盒软妹~` 提交于 2020-08-10 22:11:25
问题 I'm creating a little game in Javascript, and I have trees that can hold a certain amount of max experience, and each tree have a varied amount of branches that also needs to be leveled up with experience, and they should total to the tree max experience. If it was that easy, I would just divide them equally, like max / branches , but since it's for a game, I need to make a formula where the first branch needs no experience, and then each branch experience needed steadily increase (while

Rotating a gun while flipping it in Unity

删除回忆录丶 提交于 2020-06-29 03:45:28
问题 I have a c# script that can rotate a gun to point at the cursor. I needed the gun to flip to the other side of the player when the cursor is above or below the player. I solved this problem with the following script: (inside the update function) Vector2 weaponDistance = Camera.main.ScreenToWorldPoint(Input.mousePosition) - weapon.transform.position; float weaponRotation = Mathf.Atan2 (weaponDistance.y, weaponDistance.x) * Mathf.Rad2Deg; if (weaponRotation < 90f && weaponRotation > -90f) {

Pygame lags after drawing full window grid

徘徊边缘 提交于 2020-06-28 09:53:34
问题 I was coded a simple pygame grid window. but pygame window start lag after that. Here is that simple code👇 import pygame import random pygame.init() pygame.font.init() screen_width = 500 screen_height = screen_width screen = pygame.display.set_mode((screen_width,screen_height)) pygame.display.set_caption("Snake GaMe By Akila") def drawGrid(): grid_list = [] blockSize = 25 for x in range(screen_width): for y in range(screen_height): rect = pygame.Rect(x*blockSize, y*blockSize, blockSize,

How do i change the code so that the player stops at the edges rather than wrapping around?

心不动则不痛 提交于 2020-06-28 04:13:11
问题 WIDTH = 800 HEIGHT = 500 background = Actor("background") player = Actor("player") player.x = 200 player.y = 200 def draw(): screen.clear() background.draw() player.draw() def update(): if keyboard.right: player.x = player.x + 4 if keyboard.left: player.x = player.x - 4 if keyboard.down: player.y = player.y + 4 if keyboard.up: player.y = player.y - 4 if player.x > WIDTH: player.x = 0 if player.x < 0: player.x = WIDTH if player.y < 0: player.y = HEIGHT if player.y > HEIGHT: player.y = 0 I want

How can I use different images for my snake's body parts in my snake game? (Python, Pygame, Snake)

谁都会走 提交于 2020-05-13 10:55:13
问题 Explanation I am currently working on a snake game with Pygame but I have a problem because my snake currently consists only of squares but I would find it better if the snake contained a drawn 25x25 picture for the snake head, the body, the tail and for a bent body part so that when the snake changes its height and direction, this part still looks connected to the snake. I have also added a sample image so that you can better understand what I mean by the diffrent body parts. This is the

How can I use different images for my snake's body parts in my snake game? (Python, Pygame, Snake)

拥有回忆 提交于 2020-05-13 10:54:00
问题 Explanation I am currently working on a snake game with Pygame but I have a problem because my snake currently consists only of squares but I would find it better if the snake contained a drawn 25x25 picture for the snake head, the body, the tail and for a bent body part so that when the snake changes its height and direction, this part still looks connected to the snake. I have also added a sample image so that you can better understand what I mean by the diffrent body parts. This is the

Physx - linking problem with come functions (__imp_PxCreateBasePhysics referenced in function…)

会有一股神秘感。 提交于 2020-03-24 06:27:08
问题 I'm trying to implement PhysX into my game engine, but I have got some weird problems with linking the PhysX library. It always fails no matter what I do, but snippets from Nvidia works like a charm. I will try to describe what I did and I hope someone will find what I'm missing. First of all, I downloaded PhysX 4.1 from Github. Then I changed buildtools settings to those: <?xml version="1.0" encoding="utf-8"?> <preset name="vc15win64" comment="VC15 Win64 PhysX general settings"> <platform

Rewarded video from AdMob in Unity - loading so slow

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-25 09:39:05
问题 Previously I used Unity Ads to display interstitial and rewarded ads in my game made with unity but now I'm switching to Google Ads (AdMob). I read documentation from here and next from here and everything seems like it's working, but kinda slow. I have 3 scenes: Main Menu Game Shop I need to display rewarded ads in Game and Shop scenes. In the Game scene, the user has the ability to watch an ad to continue where he dies. He have only 5 sec to do that. If he doesn't watch an ad, then he has

VB.NET - Movement Blocked due to Faulty Collision Detection

£可爱£侵袭症+ 提交于 2020-01-24 16:27:06
问题 So, I am making a game for my programming class as part of my final project. I'm just in the planning and experimenting stage at the moment and I decided to get a headstart on graphics and collisions. I first made my program just by experimenting with the Graphics class VB has to offer, instead of using PictureBox es. Alongside that, I added keyboard input to move an Image around. When I decided to add collision detection through the intersectsWith() method of the Image class, things became