Open develperbayman opened 2 months ago
Hello! Thanks for for interest in DUGA.
Can you capture a video of your issue? I am unsure, what you mean by spinning to the right.
Also, please elaborate on the last sentence - what are you looking for, exactly?
best, MaxwellSalmon
sorry just seeing this yes i will capture but i have to run out the door rn but when i get back .....yeah when i start the game as soon as it shows its like im holding down the right arrow key and the player spins to the right non stop .....im on debian bookworm ....and my keyboard is ok
im building a very unique python based linux operating system pylinux and im looking for a few games to include its all open source and free im looking for a 100% python multiplayer call of duty replacement ....i guess im also asking permission? (im not sure about the rules tbh) it will also link back to this repo with full credits ......its not so much about being a AAA game so much as a game the community can hack on and play and have fun with
simplescreenrecorder-2024-08-17_15.54.26.mkv.zip i had to do it in a zip it wont let me just do a video
i tried to change this
madd = self.mouse.get_rel()[0] * self.sensitivity
if madd > 38:
madd = 38
elif madd < -38:
madd = -38
self.angle -= madd
SETTINGS.player_angle = self.angle
but that didnt work it also went crazy but iv managed to get it down to a crawl of a spin im kinda stumped
import SETTINGS
import EFFECTS
import INVENTORY
import SOUND
import pygame
import math
import os
class Player:
def __init__(self, pos):
self.max_speed = SETTINGS.player_speed
self.speed = 0
self.angle = SETTINGS.player_angle
self.health = SETTINGS.player_health
self.real_x = pos[0]
self.real_y = pos[1]
self.color = SETTINGS.BLUE
self.sprite = pygame.Surface([SETTINGS.tile_size / 12, SETTINGS.tile_size / 12])
self.sprite.fill(self.color)
self.rect = self.sprite.get_rect()
self.rect.x = self.real_x
self.rect.y = self.real_y
SETTINGS.player_rect = self.rect
self.last_pos_tile = None
self.mouse = pygame.mouse
self.sensitivity = SETTINGS.sensitivity
self.gun = 0
self.gunsprites_aim = []
self.gunsprites_shoot = []
SETTINGS.player = self
self.collide_list = SETTINGS.all_solid_tiles + SETTINGS.npc_list
self.update_collide_list = False
self.solid = True
self.dead = False
self.last_call = 0
self.type = 'player'
self.hurt_sound = pygame.mixer.Sound(os.path.join('sounds', 'other', 'damage.ogg'))
self.change_level = pygame.mixer.Sound(os.path.join('sounds', 'other', 'next_level.ogg'))
self.current_level = SETTINGS.current_level
# input variables
self.mouse2 = 0
self.inventory = 0
self.esc_pressed = False
self.dont_open_menu = False
def direction(self, offset, distance):
if distance == 0:
direction = [math.cos(math.radians(self.angle + offset)), -math.sin(math.radians(self.angle + offset))]
else:
direction = [(math.cos(math.radians(self.angle + offset))) * distance, (-math.sin(math.radians(self.angle + offset))) * distance]
return direction
def control(self, canvas):
# Make sure the collide list is complete
if len(self.collide_list) != len(SETTINGS.all_solid_tiles + SETTINGS.npc_list):
self.collide_list = SETTINGS.all_solid_tiles + SETTINGS.npc_list
elif self.current_level != SETTINGS.current_level:
self.collide_list = SETTINGS.all_solid_tiles + SETTINGS.npc_list
self.current_level = SETTINGS.current_level
elif self.update_collide_list:
self.collide_list = SETTINGS.all_solid_tiles + SETTINGS.npc_list
self.update_collide_list = False
# Update health
if self.health != SETTINGS.player_health and SETTINGS.player_states['heal']:
self.health = SETTINGS.player_health
key = pygame.key.get_pressed()
# Movement controls (WASD)
if not SETTINGS.player_states['dead']:
# Inventory open
if not SETTINGS.player_states['invopen']:
if SETTINGS.aiming:
self.sensitivity = SETTINGS.sensitivity / 3
self.max_speed = SETTINGS.player_speed / 3
else:
self.sensitivity = SETTINGS.sensitivity
self.max_speed = SETTINGS.player_speed
if key[pygame.K_a] or key[pygame.K_d] or key[pygame.K_w] or key[pygame.K_s]:
if self.speed < self.max_speed:
self.speed += 50
if self.speed > self.max_speed:
self.speed = self.max_speed
else:
if self.speed > 0:
if self.last_call == 0:
self.move(self.direction(90, self.speed * 0.8))
elif self.last_call == 1:
self.move(self.direction(-90, self.speed * 0.8))
elif self.last_call == 2:
self.move(self.direction(0, self.speed))
elif self.last_call == 3:
self.move(self.direction(0, -self.speed * 0.5))
self.speed -= 80
if self.speed < 0:
self.speed = 0
if key[pygame.K_a]:
self.move(self.direction(90, self.speed * 0.8))
self.last_call = 0
if key[pygame.K_d]:
self.move(self.direction(-90, self.speed * 0.8))
self.last_call = 1
if key[pygame.K_w]:
self.move(self.direction(0, self.speed))
self.last_call = 2
if key[pygame.K_s]:
self.move(self.direction(0, -self.speed * 0.5))
self.last_call = 3
SETTINGS.player_states['cspeed'] = self.speed
# Shoot gun (Mouse input)
if pygame.mouse.get_pressed()[2] and self.mouse2 < 1:
SETTINGS.mouse2_btn_active = True
self.mouse2 += 1
elif self.mouse2 >= 1:
SETTINGS.mouse2_btn_active = False
if not pygame.mouse.get_pressed()[2]:
self.mouse2 = 0
if pygame.mouse.get_pressed()[0] and not SETTINGS.player_states['dead']:
SETTINGS.mouse_btn_active = True
else:
SETTINGS.mouse_btn_active = False
if key[pygame.K_r]:
SETTINGS.reload_key_active = True
else:
SETTINGS.reload_key_active = False
# Change gun
if key[pygame.K_1] and SETTINGS.inventory['primary']:
SETTINGS.next_gun = SETTINGS.inventory['primary']
elif key[pygame.K_2] and SETTINGS.inventory['secondary']:
SETTINGS.next_gun = SETTINGS.inventory['secondary']
elif key[pygame.K_3] and SETTINGS.inventory['melee']:
SETTINGS.next_gun = SETTINGS.inventory['melee']
# Keep angle in place
if self.angle >= 360:
self.angle -= 360
elif self.angle < 0:
self.angle += 360
# Interact
if key[pygame.K_e]:
if SETTINGS.middle_slice:
if SETTINGS.middle_slice_len <= SETTINGS.tile_size * 1.5 and (SETTINGS.middle_slice.type == 'vdoor' or SETTINGS.middle_slice.type == 'hdoor'):
SETTINGS.middle_slice.sesam_luk_dig_op()
elif SETTINGS.middle_slice_len <= SETTINGS.tile_size and SETTINGS.middle_slice.type == 'end' and not SETTINGS.player_states['fade']:
SETTINGS.player_states['fade'] = True
SETTINGS.changing_level = True
SOUND.play_sound(self.change_level, 0)
madd = self.mouse.get_rel()[0] * self.sensitivity
if madd > 0:
madd = min(madd, 0.5)
elif madd < 0:
madd = max(madd, -0.5)
self.angle -= madd
SETTINGS.player_angle = self.angle
# Open inventory
if key[pygame.K_i] and self.inventory < 1:
if SETTINGS.player_states['invopen']:
SETTINGS.player_states['invopen'] = False
SETTINGS.inv_strings_updated = False
else:
SETTINGS.player_states['invopen'] = True
self.inventory += 1
elif not key[pygame.K_i]:
self.inventory = 0
# Use escape to close inventory
if key[pygame.K_ESCAPE] and SETTINGS.player_states['invopen']:
SETTINGS.player_states['invopen'] = False
SETTINGS.inv_strings_updated = False
self.dont_open_menu = True
elif not key[pygame.K_ESCAPE] and not SETTINGS.player_states['invopen']:
self.dont_open_menu = False
# Show menu
if key[pygame.K_ESCAPE] and not self.dont_open_menu:
self.esc_pressed = True
elif self.esc_pressed and not self.dont_open_menu:
SETTINGS.menu_showing = True
self.esc_pressed = False
# Is the player dead or taking damage?
if self.health > SETTINGS.player_health:
SETTINGS.statistics['last dtaken'] += (self.health - SETTINGS.player_health)
self.health = SETTINGS.player_health
SETTINGS.player_states['hurt'] = True
SOUND.play_sound(self.hurt_sound, 0)
if SETTINGS.player_health <= 0 and not SETTINGS.godmode:
self.dead = True
SETTINGS.player_states['dead'] = True
if SETTINGS.player_health < 0:
SETTINGS.player_health = 0
if SETTINGS.menu_showing or SETTINGS.player_states['invopen']:
pygame.event.set_grab(False)
self.mouse.set_visible(True)
else:
pygame.event.set_grab(True)
self.mouse.set_visible(False)
def move(self, pos):
if SETTINGS.cfps > 5:
if pos[0] != 0:
self.update(pos[0], 0)
if pos[1] != 0:
self.update(0, pos[1])
def update(self, x, y):
self.real_x += x * SETTINGS.dt
self.real_y += y * SETTINGS.dt
self.rect.x = self.real_x
self.rect.y = self.real_y
SETTINGS.player_rect = self.rect
tile_hit_list = pygame.sprite.spritecollide(self, self.collide_list, False)
# Actually there are not only tiles in the list. NPCs as well.
for tile in tile_hit_list:
if tile.solid:
if x > 0: # Moving right
self.rect.right = tile.rect.left
if x < 0: # Moving left
self.rect.left = tile.rect.right
if y > 0: # Moving down
self.rect.bottom = tile.rect.top
if y < 0: # Moving up
self.rect.top = tile.rect.bottom
self.real_x = self.rect.x
self.real_y = self.rect.y
SETTINGS.player_rect = self.rect
def draw(self, canvas):
canvas.blit(self.sprite, (self.real_x, self.real_y))
def destroy(self):
del self
Hmm... I have never seen this issue before. Have you tried to play it in windowed mode as well? Does this happen if you also run the .exe? (https://maxwellsalmon.itch.io/duga) Also, try to print the mouse position - the way rotation works is, that every frame your cursor is moved to the center of the screen and you move your head in the distance the cursor moved. It seems resetting to the center may be behaving unexpectedly.
As for multiplayer, this game is singleplayer only. I was planning to make it multiplayer in during development, but dropped it. And as for including the game in your OS, feel free to do so. As long as you follow the license DUGA is under. (https://www.tldrlegal.com/license/mozilla-public-license-2-0-mpl-2)
cool thanks the reason i was inquiring about multiplayer is im looking for something original to use to build this around its a python local gaming network 2+ instances 1 server split screen play because of how you did it it works well with my brain so ill prob keep poking at it and adding features ....lol or break some things ...like solitaire but with code
so window mode does not work at all simplescreenrecorder-2024-08-18_00.44.45.mkv.zip
also i dont know about the exe im running debian bookworm
title says it also if i can get it to run im interested in implementing multiplayer ...im looking for it but i dont see it