묻고 답해요
164만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
해결됨[C#과 유니티로 만드는 MMORPG 게임 개발 시리즈] Part7: MMO 컨텐츠 구현 (Unity + C# 서버 연동 기초)
모바일 게임 용으로 개발 중입니다.
안녕하세요 강사님 1. 저는 모바일 게임용으로 게임을 개발 중입니다. 그래서 키보드가 아닌 조이스틱으로 움직여 구현 해보려고 하는데요.. 조이스틱으로 이동까지는 가능하게 했는데 그리드로 이동하게 해보려고하니 방향_dir를 뽑아내는게 힘듭니다 ㅠ 머리속으로는 h, v 중 큰 값으로 방향을 뽑아 낼 수 있을까 했습니다. 그런데 생각보다 잘안되네요.. public Vector3 poolInput() { float h = joystick.GetHorizontalValue(); float v = joystick.GetVerticalValue(); Vector2 moveDir = new Vector3(h, v, 0).normalized; return moveDir; } 2. 그리고 조이스틱으로 게임 구현했을 때 서버 연동시 문제가 없을까요? 메일 확인 부탁드립니다! 항상 감사드립니다!
-
해결됨설계독학맛비's 실전 Verilog HDL Season 1 (Clock부터 Internal Memory까지)
질문있습니다.
안녕하세요, 리눅스 환경에 대해 질문 있습니다. 소스 작성 과정에서, 디버깅 작업은 [syntax error , port 연결 문제 등] 어떻게 하나요? 윈도우 환경처럼 tool (modelsim, vivado 등등)을 직접 열고 확인해도 되나요? 커맨드라인으로 컴파일하고, 시뮬레이션 빌드하는 과정을 알고 싶습니다.
-
미해결자바 기본을 위한 강의 2부
질문이요.~
boolean isBoolean02 = Optional.ofNullable(manufacturingResult) .map(String::trim) .filter(s -> s.equals("success")) .isPresent(); System.out.println("생산결과 : " + isBoolean02); 여기서 map이 키 value 값에 쓰이는 그 map 이 맞나요?
-
미해결파이썬 무료 강의 (활용편1) - 추억의 오락실 게임 만들기 (3시간)
무기를 쓰고 0.5초 정도 기다리게 하고 싶어요
전체코드: import pygame ############################################################################## #기본 초기화 (반드시) pygame.init() #화면크기설정 screen_width = 640 screen_height = 480 screen = pygame.display.set_mode((screen_width, screen_height)) #화면 타이틀 설정 pygame.display.set_caption("pang game") # FPS clock = pygame.time.Clock() ############################################################################## #배경 만들기 background = pygame.image.load("C:\\Users\\w10\\Desktop\\python work space\\pygame_basic\\pygame_project\\images\\background.png") #스테이지 만들기 stage = pygame.image.load("C:\\Users\\w10\\Desktop\\python work space\\pygame_basic\\pygame_project\\images\\stage.png") stage_size = stage.get_rect().size stage_height = stage_size[1] #캐릭터 만들기 character = pygame.image.load("C:\\Users\\w10\\Desktop\\python work space\\pygame_basic\\pygame_project\\images\\character.png") character_size = character.get_rect().size character_width = character_size[0] character_height = character_size[1] character_x_pos = (screen_width / 2) - (character_width / 2) character_y_pos = screen_height - character_height - stage_height #캐릭터 이동 방향 character_to_x_LEFT = 0 character_to_x_RIGHT = 0 #캐릭터 이동 속도 character_speed = 5 #무기 만들기 weapon = pygame.image.load("C:\\Users\\w10\\Desktop\\python work space\\pygame_basic\\pygame_project\\images\\weapon.png") weapon_size = weapon.get_rect().size weapon_width = weapon_size[0] #무기는 한 번에 여러 발 발사 가능 weapons = [] #무기 이동 속도 weapon_speed = 10 #공 만들기 (4개 크기에 대해 따로 처리) ball_images = [ pygame.image.load("C:\\Users\\w10\\Desktop\\python work space\\pygame_basic\\pygame_project\\images\\balloon1.png"), pygame.image.load("C:\\Users\\w10\\Desktop\\python work space\\pygame_basic\\pygame_project\\images\\balloon2.png"), pygame.image.load("C:\\Users\\w10\\Desktop\\python work space\\pygame_basic\\pygame_project\\images\\balloon3.png"), pygame.image.load("C:\\Users\\w10\\Desktop\\python work space\\pygame_basic\\pygame_project\\images\\balloon4.png")] #공 크기에 따른 최초 스피드 ball_speed_y = [-18, -15, -12, -9] #공들 balls = [] #최초 발생하는 큰 공 추가 balls.append({ "pos_x" : 50, "pos_y" : 50, "img_idx" : 0, "to_x": 3, "to_y": -6, "init_spd_y": ball_speed_y[0]}) #사라질 무기, 공 정보 저장 변수 weapon_to_remove = -1 ball_to_remove = -1 #Font 정의 game_font = pygame.font.Font(None, 40) total_time = 100 start_ticks = pygame.time.get_ticks() #게임 종료 메시지 game_result = "Game Over" #이벤트 루프 running = True while running: dt = clock.tick(30) #키보드 이벤트 for event in pygame.event.get(): if event.type == pygame.QUIT: running = False if event.type == pygame.KEYDOWN: if event.key == pygame.K_LEFT: character_to_x_LEFT -= character_speed elif event.key == pygame.K_RIGHT: character_to_x_RIGHT += character_speed elif event.key == pygame.K_SPACE: weapon_x_pos = character_x_pos + (character_width / 2) - (weapon_width / 2) weapon_y_pos = character_y_pos weapons.append([weapon_x_pos, weapon_y_pos]) if event.type == pygame.KEYUP: if event.key == pygame.K_LEFT: character_to_x_LEFT = 0 elif event.key == pygame.K_RIGHT: character_to_x_RIGHT = 0 #게임 캐릭터 위치 정의 character_x_pos += character_to_x_LEFT + character_to_x_RIGHT if character_x_pos < 0: character_x_pos = 0 elif character_x_pos > screen_width - character_width: character_x_pos = screen_width - character_width #무기 위치 조정 weapons = [ [w[0], w[1] - weapon_speed] for w in weapons] #천장에 닿은 무기 없애기 weapons = [ [w[0], w[1]] for w in weapons if w[1] > 0] #공 위치 정의 for ball_idx, ball_val in enumerate(balls): ball_pos_x = ball_val["pos_x"] ball_pos_y = ball_val["pos_y"] ball_img_idx = ball_val["img_idx"] ball_size = ball_images[ball_img_idx].get_rect().size ball_width = ball_size[0] ball_height = ball_size[1] #가로 벽에 닿았을 때 공 이동 위치 변경 (튕겨 나오는 효과) if ball_pos_x < 0 or ball_pos_x > screen_width - ball_width: ball_val["to_x"] = ball_val["to_x"] * -1 #세로 위치 #스테이지에 튕겨서 올라가는 처리 if ball_pos_y >= screen_height - stage_height - ball_height: ball_val["to_y"] = ball_val["init_spd_y"] else: ball_val["to_y"] += 0.5 ball_val["pos_x"] += ball_val["to_x"] ball_val["pos_y"] += ball_val["to_y"] #충돌 처리 #캐릭터 rect 정보 업데이트 character_rect = character.get_rect() character_rect.left = character_x_pos character_rect.top = character_y_pos for ball_idx, ball_val in enumerate(balls): ball_pos_x = ball_val["pos_x"] ball_pos_y = ball_val["pos_y"] ball_img_idx = ball_val["img_idx"] #공 rect 정보 업데이트 ball_rect = ball_images[ball_img_idx].get_rect() ball_rect.left = ball_pos_x ball_rect.top = ball_pos_y #공과 캐릭터 충돌 체크 if character_rect.colliderect(ball_rect): running = False break #공과 무기들 충돌 처리 for weapon_idx, weapon_val in enumerate(weapons): weapon_x_pos = weapon_val[0] weapon_y_pos = weapon_val[1] #무기 rect 정보 업데이트 weapon_rect = weapon.get_rect() weapon_rect.left = weapon_x_pos weapon_rect.top = weapon_y_pos #충돌체크 if weapon_rect.colliderect(ball_rect): weapon_to_remove = weapon_idx ball_to_remove = ball_idx #가장 작은 크기의 공이 아니라면 다음 단계의 공으로 나눠주기 if ball_img_idx < 3: #현재 공 크기 정보를 가지고 옴 ball_width = ball_rect.size[0] ball_height = ball_rect.size[1] #나눠진 공 정보 small_ball_rect = ball_images[ball_img_idx + 1].get_rect() small_ball_width = small_ball_rect.size[0] small_ball_height = small_ball_rect.size[1] #왼쪽으로 튕겨나가는 작은 공 balls.append({ "pos_x" : ball_pos_x + (ball_width / 2) - (small_ball_width / 2), "pos_y" : ball_pos_y + (ball_height / 2) - (small_ball_height / 2), "img_idx" : ball_img_idx + 1, "to_x": -3, "to_y": -6, "init_spd_y": ball_speed_y[ball_img_idx + 1]}) #오른쪽으로 튕겨나가는 작은 공 balls.append({ "pos_x" : ball_pos_x + (ball_width / 2) - (small_ball_width / 2), "pos_y" : ball_pos_y + (ball_height / 2) - (small_ball_height / 2), "img_idx" : ball_img_idx + 1, "to_x": 3, "to_y": -6, "init_spd_y": ball_speed_y[ball_img_idx + 1]}) break else: continue break #충돌된 공 or 무기 없애기 if ball_to_remove > -1: del balls[ball_to_remove] ball_to_remove = -1 if weapon_to_remove > -1: del weapons[weapon_to_remove] weapon_to_remove = -1 if len(balls) == 0: game_result = "Mission Complete" running = False # 화면에 그리기 screen.blit(background, (0, 0)) for weapon_x_pos, weapon_y_pos in weapons: screen.blit(weapon, (weapon_x_pos, weapon_y_pos)) for idx, val in enumerate(balls): ball_pos_x = val["pos_x"] ball_pos_y = val["pos_y"] ball_img_idx = val["img_idx"] screen.blit(ball_images[ball_img_idx], (ball_pos_x, ball_pos_y)) screen.blit(stage, (0, screen_height - stage_height)) screen.blit(character, (character_x_pos, character_y_pos)) #경과 시간 계산 elapsed_time = (pygame.time.get_ticks() - start_ticks) / 1000 timer = game_font.render("Time : {}".format(int(total_time - elapsed_time)), True, (255, 255, 255)) screen.blit(timer, (10, 10)) if total_time - elapsed_time <= 0: game_result = "Time Over" running = False pygame.display.update() msg = game_font.render(game_result, True, (255, 0, 0)) msg_rect = msg.get_rect(center=(int(screen_width / 2), int(screen_height / 2))) screen.blit(msg, msg_rect) pygame.display.update() pygame.time.delay(2000) #파이게임 종료 pygame.quit()
-
미해결스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
http://localhost:8080/hello 에러 관련
인텔리j 커뮤니티에서 안되어 이클립스에서 했는데 index.html까지는 되는데 hello 링크를 클릭하면 아래 처럼 에러가 발생합니다. 해당 소스 git에 올렸습니다. 원인을 알 수 있을까요? 감사합니다. https://github.com/pulmuone/hello
-
미해결CSS Flex와 Grid 제대로 익히기
이미지태그 질문요!
img 태그와 figure 태그와 위 둘은 html이며 주요 콘텐츠, 카드 UI일때 사용하고 background-image의 차이를 알고 싶어요. 얘는 CSS 배경요소로 꾸며줄때 사용하는 거는 알겠는데 img랑 figure 태그 사용 차이점이 헷갈려요. 혹시 제가 놓친 부분이 있다면 알려주세요!
-
미해결시스템엔지니어가 알려주는 리눅스 실전편 Bash Shell Script
초기 설정 질문드립니다.
제 cent1은 df -h 했을 시 / 파티션 용량이 100% 아닌데 처음에 잘못 설치해서 그런가요?
-
미해결모든 개발자를 위한 HTTP 웹 기본 지식
put과 patch에 대해 질문드립니다
put 과 patch에 이해가 아직 부족해 질문드립니다 게시판 글 수정을 할 때를 예로 들어보겠습니다 클라이언트에서 서버에 요청을 put으로 하던 patch로 하던 서버에서는 req.body에 들어있는 수정할 내용으로 DB에 쿼리문을 요청해 처리하잖아요? 이 때도 put과 patch의 차이가 유의미한지 궁금합니다. 실무에서도 이 두개를 같이 사용하고 있는지도 궁금합니다 공부할때 매번 put만 사용해봐서 patch에 필요에 대한 이해가 아직 많이 부족해 제 질문이 맞는 질문인지도 모르겠네요.. 강의 잘 듣고 있습니다 감사합니다
-
미해결[C#과 유니티로 만드는 MMORPG 게임 개발 시리즈] Part4: 게임 서버
각 소켓 주소는 하나만 사용할 수 있습니다.
안녕하세요. 강의 잘 보고있습니다~. '소켓 프로그래밍' 들으면서 실습을 따라해봣는데 다음과 같이 Exception이 뜹니다. 뭐가 문제일까요?
-
미해결스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
Intellij
선생님! 같은 환경에서 따라해보려고 intellij 다운받아보려고 하는데 말씀해주신것처럼 Communiy용으로 다운받아도 상관없나요? 이후 스프링 mvc웹개발 강의에서도 Community용으로 실습 할수 있나해서요
-
해결됨[C#과 유니티로 만드는 MMORPG 게임 개발 시리즈] Part4: 게임 서버
쓰레드 While 문 질문입니다
ThreadMain함수 안에서 release 모드에서는 코드가 변형이 되어 while(_stop == false) 가 if (stop == false) while(true) 형태로 변형이 된다고 하셨는데 그러면 쓰레드를 사용하는 경우에 while(_stop == false) 같은 형식을 쓰는 것을 자제해야 하는건가요? 지금이야 몇줄 안되서 멈추는 원인을 찾기 쉬웠겠지만 나중에 코드가 길어질 경우 그런 변형으로 인한 오류 부분이 나타나면 찾기 어려울것 같은데 어떻게 해야 하나요?
-
미해결인터랙티브 웹 개발 제대로 시작하기
출력값
let timeId; function sample() { console.log('sample!'); } timeId = setTimeout(sample, 1000); console.log(timeId); 콘솔창에 1이랑 sample!이 같이 출력되는데 1은 무엇을 의미하나요..?
-
미해결예제로 배우는 스프링 입문 (개정판)
제어권의 역전이라는 것이.....
OwnerController 내부에서 리파지토리 인스턴스를 생성할 경우 리파지토리는 OwnerController의 생명주기?와 같다, 의존한다고 보면 되는거죠? 그리고 OwnerController 클래스 블록 내부에서 생성된 인스턴스들은 모두 OwnerController가 제어권을 가지고 있다고 이해했습니다. 그리고 기존 new를 통해 인스턴스를 만들던 것을 클래스 내부에서는 이러한 타입의 객체를 사용할 것이다 라고 선언만 해두고 클래스 외부에서 객체를 생성해서 주입한다라는 것을 의존성 주입이라고 생각하면 될까요??
-
해결됨공공데이터로 파이썬 데이터 분석 시작하기
seaborn으로 그린 그래프의 x축 소수점 없애는 법
안녕하세요? sns으로 boxplot 그래프를 그려봤습니다. 그런데 x축의 눈금이 정수가 아닌 실수로 표현됩니다.(예를 들면, 35가 35.0으로 표현) 소수점 없이 정수로 표현하는 방법이 있을까요? 답변 부탁드리겠습니다. 감사합니다.
-
미해결파이썬 무료 강의 (활용편2) - GUI 프로그래밍 (4시간)
Radiobutton 기본값 설정
안녕하세요 강의 잘 보고있습니다. 예제에서 Radiobutton에 경우 기본값으로 하나를 선택하게 만들고 싶어 set을 사용해 보았는데 오류가 나네요... e x) Language 의 기본값을 Python 으로 지정되게 시작될수 있도록 할수 있나요?
-
해결됨스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
Test method 접근제어자 질문드립니다.
안녕하세요. 강의를 듣던 중 테스트 메소드 접근 제어자에 궁금한점이 생겨서 질문드립니다. [회원 리포지토리 테스트] @Test public void save() { ... } [서비스 테스트] @Test void join() { ... } 이전 회원 리포지토리 테스트 코드에서는 위 코드와 같이 public로 선언했었지만, 이번 강의에서 Create Test 단축키로 생성한 테스트 메소드들은 public가 아닌 default로 선언되었습니다. default로 메소드를 선언했을 때 테스트를 수행하는데 문제가 없었는데 강의 코드에서 public으로 메소드를 선언하는 이유는 무엇인가요?
-
미해결파이썬 무료 강의 (활용편2) - GUI 프로그래밍 (4시간)
정말 신기한게 root = Tk() 복사한것과 내가 적은것과 결과가 달라요
root = TK() 라고 키보드에서 치면 NameError: name 'TK' is not defined 라고 나오는데 구글에서 root = Tk() 를 긁어오면 동작을 합니다
-
미해결웹 게임을 만들며 배우는 Vue
홈런일 때
홈런일 땐 초기화가 되는 것이니 this.tries.push({ try: this.value, result: '홈런', }); 이 부분을 기재하지 않아도 상관 없나요??
-
ESXi 가상 인프라 구축과 보안 솔루션을 활용한 이상징후 탐지 모니터링
설치 에러 문구
삭제된 글입니다
-
미해결웹 게임을 만들며 배우는 Vue
v-for"t in tries" :key="t.try"
강의에선 :key 를 기재 하시 않으셨는데 완성본에선 key가 있더라구요! 해당 내용에 대해서 찾아봣으나 정확하게 이해가 되지 않아서 여쭤봅니다. key="t.try"가 의미하는 바는 무엇인가요??