no image
[고1 게임엔진] 11 - (2)
보낼 파일 public class GameCounter : MonoBehaviour { // 1. 카운터 본체를 만든다. public static int count; // 공유하는 카운터의 값 public int startCount = 0; // 카운터 초깃값 private void Start() { count = startCount; // 카운터값 리셋 } } ------------------------------------------------------- using UnityEngine.UI; // UI 사용 public class Forever_ShowCount : MonoBehaviour { // 2. 계속 카운터 값을 표시한다. void Update() { GetComponent().text ..
2023.11.20
no image
[고1 프로그래밍] 11 - (4)
class Unit: def __init__(self): print("Unit 생성자") class Flyable: def __init__(self): print("Flyable 생성자") class FlyableUnit(Unit, Flyable): def __init__(self): #super().__init__() Unit.__init__(self) Flyable.__init__(self) # 드랍쉽 dropship = FlyableUnit() 나도코딩 - 스타크래프트 try: print("나누기 전용 계산기입니다.") num1 = int(input("첫 번째 숫자를 입력하세요 : ")) num2 = int(input("두 번째 숫자를 입력하세요 : ")) print("{0} / {1} = {2}"..
2023.11.20
no image
[고1 프로그래밍] 11 - (3)
# 일반 유닛 class Unit: def __init__(self, name, hp, speed): self.name = name self.hp = hp self.speed = speed def move(self, location): print("[지상 유닛 이동]") print("{0} : {1} 방향으로 이동합니다. [속도 : {2}]"\ .format(self.name, location, self.speed)) # 메딕 : 의무병(공격력 없음, 사람으로 된 유니싱 다쳤을 때 치료해주어 체력을 회복시켜 줌) # 공격 유닛 class AttackUnit(Unit): def __init__(self, name, hp, speed, damage): Unit.__init__(self, name, hp, s..
2023.11.15
no image
[고1 게임엔진] 11 - (1)
using System.Collections; using System.Collections.Generic; using UnityEngine; public class OnUpKeyPress_Throw : MonoBehaviour { // 플레이어 이동, 반전관련 변수선언 public float speed = 5; float vx; // x축 이동량 bool leftFlag = false; // 좌우반전 bool upFlag = false; // 위쪽 방향키 눌렸는지 여부 //프리팹 만들기------------------------------------ public GameObject sushi; // 공장에 넘겨줄 원본(프리팹) GameObject newSushi; // 공장에 찍어낸 새로운 아이템(프리팹..
2023.11.13
no image
[고1 프로그래밍] 11 - (2)
# 일반 유닛 class Unit: def __init__(self, name, hp, speed): self.name = name self.hp = hp self.speed = speed def move(self, location): print("[지상 유닛 이동]") print("{0} : {1} 방향으로 이동합니다. [속도 : {2}]"\ .format(self.name, location, self.speed)) # 메딕 : 의무병(공격력 없음, 사람으로 된 유니싱 다쳤을 때 치료해주어 체력을 회복시켜 줌) # 공격 유닛 class AttackUnit(Unit): def __init__(self, name, hp, speed, damage): Unit.__init__(self, name, hp, s..
2023.11.13
no image
[고1 화면구현] 11 - (1)
마우스 올려 보세요 ​ 마우스 올려 보세요 마우스 올려 보세요 링크의 href에 자바스크립트 작성 클릭해보세요 lib.js function over(obj) { obj.src="banana.png"; } function out(obj) { obj.src="apple.png"; } document.write()로 HTML 콘텐츠 출력
2023.11.09
no image
[고1 프로그래밍] 11 - (1)
# 일반 유닛 class Unit: def __init__(self, name, hp, speed): self.name = name self.hp = hp self.speed = speed def move(self, location): print("[지상 유닛 이동]") print("{0} : {1} 방향으로 이동합니다. [속도 : {2}]"\ .format(self.name, location, self.speed)) # 메딕 : 의무병(공격력 없음, 사람으로 된 유니싱 다쳤을 때 치료해주어 체력을 회복시켜 줌) # 공격 유닛 class AttackUnit(Unit): def __init__(self, name, hp, speed, damage): Unit.__init__(self, name, hp, s..
2023.11.08
no image
[고1 화면구현] 10 - (4)
1 Who am I? 프런트엔드 웹 기술(Front-end Web Tech.)에 관심이 많습니다. 현재 제주의 한 시골 마을에서 코딩 중입니다. 2 Who am I? 프런트엔드 웹 기술(Front-end Web Tech.)에 관심이 많습니다. 현재 제주의 한 시골 마을에서 코딩 중입니다. style.css h2 { color : blue; } p { font-size:0.9em; line-height: 2.0; } 3 블루베리와 항산화 효능 블루베리는 항산화제인 안토시아닌과 폴리페놀을 다량 포함하고 있습니다. 매사츄세츠 보스톤에 있는 USDA 노화에 관한 인류 영양 연구센터 (the USDA Human Nutrition Research Center on Aging) 의 자료에 의하면 블루베리는 과일 중에..
2023.10.26
no image
[고1 국어] 2학기 1차 지필평가
[한글 맞춤법의 원리와 내용] 제1항 표준어를 ‘소리대로’ 적는다. + 어법에 맞도록 한다. ('하늘', '오리', '날다') 제2항 단어를 단위로 하여 띄어 쓴다. 다만 조사는 앞말에 붙여 쓴다. ('나 물 좀 줘.', '나는 너를 좋아해.') 제19항 어간에 '-이'나 '-음/-ㅁ'이 붙어 명사로 된 것과 '-이'나 '-히'가 붙어서 부사로 된 것은 어간의 원형을 밝히어 적는다. (다듬다 ➜ 다듬이) 제19항 [붙임] 이외는 어간의 원형을 밝히어 적지 않는다. (맞다 ➜ 마중) 제20항 명사에 '-이'가 붙어서 된 말은 명사의 원형을 밝히어 적는다. (낱낱 ➜ 낱낱이) 제20항 [붙임] 이외는 명사의 원형을 밝히어 적지 않는다. (잎 ➜ 이파리) 제41항 조사는 앞말에 붙여 쓴다. (꽃을, 꽃밖에, ..
2023.10.19

보낼 파일

public class GameCounter : MonoBehaviour
{
    // 1. 카운터 본체를 만든다.

    public static int count; // 공유하는 카운터의 값
    public int startCount = 0; // 카운터 초깃값
    private void Start()
    {
        count = startCount; // 카운터값 리셋
    }
}

-------------------------------------------------------

using UnityEngine.UI; // UI 사용

public class Forever_ShowCount : MonoBehaviour
{
    // 2. 계속 카운터 값을 표시한다.

    void Update()
    {
        GetComponent<Text>().text = GameCounter.count.ToString();
    }
}

-------------------------------------------------------

public class OnCollision_CountAndHide : MonoBehaviour
{
    // 플레이어와 충돌하면 카운터를 1씩 증가하고, 자신은 사라진다. (삭제한다)

    public string targetName; // 목표 오브젝트 저장

    private void OnCollisionEnter2D(Collision2D collision)
    {
        // 만약 충돌한 것이 목표 오브젝트라면
        if (collision.gameObject.name == targetName)
        {
            // 카운터 1씩 증가시키고
            GameCounter.count++;

            // 자기자신 삭제
            this.gameObject.SetActive(false);
        }
    }
}

-------------------------------------------------------

using UnityEngine.SceneManagement; // 씬 전환에 필요

public class OnFinished : MonoBehaviour
{
    public int lastCount = 3; // 카운터의 최종값
    public string sceneName;  // 씬 이름 저장

    private void FixedUpdate()
    {
        // 카운터가 최종값(3)이 되면
        if (GameCounter.count == lastCount)
        {
            // 씬 전환
            SceneManager.LoadScene(sceneName);
        }
    }
}

 

 

초밥 액션 게임

 

 

Text UI 추가

 

카메라 설정

 

텍스트 가운데 정렬

 

Canvas - Text에 적용

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GameCounter : MonoBehaviour
{
    // 1. 카운터 본체를 만든다.

    public static int count; // 공유하는 카운터의 값
    public int startCount = 0; // 카운터 초깃값
    private void Start()
    {
        count = startCount; // 카운터값 리셋
    }
}

 

Canvas - Jumsu에 적용 (Scene Name에 SecondScene)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI; // UI 사용

public class Forever_ShowCount : MonoBehaviour
{
    // 2. 계속 카운터 값을 표시한다.

    void Update()
    {
        GetComponent<Text>().text = GameCounter.count.ToString();
    }
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement; // 씬 전환에 필요

public class OnFinished : MonoBehaviour
{
    public int lastCount = 3; // 카운터의 최종값
    public string sceneName;  // 씬 이름 저장

    private void FixedUpdate()
    {
        // 카운터가 최종값(3)이 되면
        if (GameCounter.count == lastCount)
        {
            // 씬 전환
            SceneManager.LoadScene(sceneName);
        }
    }
}

 

초밥에 적용 (TargetName에 Player)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class OnCollision_CountAndHide : MonoBehaviour
{
    // 플레이어와 충돌하면 카운터를 1씩 증가하고, 자신은 사라진다. (삭제한다)

    public string targetName; // 목표 오브젝트 저장

    private void OnCollisionEnter2D(Collision2D collision)
    {
        // 만약 충돌한 것이 목표 오브젝트라면
        if (collision.gameObject.name == targetName)
        {
            // 카운터 1씩 증가시키고
            GameCounter.count++;

            // 자기자신 삭제
            this.gameObject.SetActive(false);
        }
    }
}

 

 

빌드

'----------고1---------- > 게임엔진' 카테고리의 다른 글

[고1 게임엔진] 12 - (1)  (5) 2023.12.27
[고1 게임엔진] 11 - (1)  (0) 2023.11.13
[고1 게임엔진] 10 - (3)  (0) 2023.10.18
[고1 게임엔진] 10 - (2)  (2) 2023.10.16
[고1 게임엔진] 10 - (1)  (0) 2023.10.11
class Unit:
    def __init__(self):
        print("Unit 생성자")

class Flyable:
    def __init__(self):
        print("Flyable 생성자")

class FlyableUnit(Unit, Flyable):
    def __init__(self):
        #super().__init__()
        Unit.__init__(self)
        Flyable.__init__(self)

# 드랍쉽
dropship = FlyableUnit()

나도코딩 - 스타크래프트

try:
    print("나누기 전용 계산기입니다.")
    num1 = int(input("첫 번째 숫자를 입력하세요 : "))
    num2 = int(input("두 번째 숫자를 입력하세요 : "))
    print("{0} / {1} = {2}".format(num1, num2, int(num1/num2)))
except ValueError:
    print("에러! 잘못된 값을 입력하였습니다.")
# 일반 유닛
class Unit:
    def __init__(self, name, hp, speed):
        self.name = name
        self.hp = hp
        self.speed = speed

    def move(self, location):
        print("[지상 유닛 이동]")
        print("{0} : {1} 방향으로 이동합니다. [속도 : {2}]"\
                .format(self.name, location, self.speed))
        
# 메딕 : 의무병(공격력 없음, 사람으로 된 유니싱 다쳤을 때 치료해주어 체력을 회복시켜 줌)
# 공격 유닛
class AttackUnit(Unit):
    def __init__(self, name, hp, speed, damage):
        Unit.__init__(self, name, hp, speed)
        self.damage = damage

    def attack(self, location):
        print("{0} : {1} 방향으로 적군을 공격합니다.[공격력 : {2}"\
                .format(self.name, location, self.damage))
        
    def damaged(self, damage):
        print("{0} : {1} 데미지를 입었습니다.".format(self.name, damage))
        self.hp -= damage
        print("{0} : 현제 체력은 {1} 입니다.".format(self.name, self.hp))
        if self.hp <= 0:
            print("{0} : 파괴되었습니다.".format(self.name))
    
# 드랍쉽 : 공중 유닛, 수송기, 마린/파이어뱃/탱크 등을 수송. 공격 불가
# 날 수 있는 기능을 가진 클래스
class Flyable:
    def __init__(self, flying_speed):
        self.flying_speed = flying_speed

    def fly(self, name, location):
        print("{0} : {1} 방향으로 날아갑니다.[속도 : {2}]"\
                .format(name, location, self.flying_speed))
        
# 날 수 있는 공격 유닛 클래스
class FlyableAttackUnit(AttackUnit, Flyable):
    def __init__(self, name, hp, damage, flying_speed):
        AttackUnit.__init__(self, name, hp, 0, damage) # 지상 speed는 0
        Flyable.__init__(self, flying_speed)

    def move(self, location):
        print("[공중 유닛 이동]")
        self.fly(self.name, location)

# 벌처 : 지상 유닛, 기동성이 좋음
vulture = AttackUnit("벌쳐", 80, 10, 20)

# 배틀크루저 : 공중 유닛, 체력이 굉장히 좋음, 공격력도 좋음
battlecruiser = FlyableAttackUnit("배틀크루저", 500, 25, 3)

vulture.move("11시")
battlecruiser.move("9시")
# 일반 유닛
class Unit:
    def __init__(self, name, hp, speed):
        self.name = name
        self.hp = hp
        self.speed = speed

    def move(self, location):
        print("[지상 유닛 이동]")
        print("{0} : {1} 방향으로 이동합니다. [속도 : {2}]"\
                .format(self.name, location, self.speed))
        
# 메딕 : 의무병(공격력 없음, 사람으로 된 유니싱 다쳤을 때 치료해주어 체력을 회복시켜 줌)
# 공격 유닛
class AttackUnit(Unit):
    def __init__(self, name, hp, speed, damage):
        Unit.__init__(self, name, hp, speed)
        self.damage = damage

    def attack(self, location):
        print("{0} : {1} 방향으로 적군을 공격합니다.[공격력 : {2}"\
                .format(self.name, location, self.damage))
        
    def damaged(self, damage):
        print("{0} : {1} 데미지를 입었습니다.".format(self.name, damage))
        self.hp -= damage
        print("{0} : 현제 체력은 {1} 입니다.".format(self.name, self.hp))
        if self.hp <= 0:
            print("{0} : 파괴되었습니다.".format(self.name))
    
# 드랍쉽 : 공중 유닛, 수송기, 마린/파이어뱃/탱크 등을 수송. 공격 불가

# 날 수 있는 기능을 가진 클래스
class Flyable:
    def __init__(self, flying_speed):
        self.flying_speed = flying_speed

    def fly(self, name, location):
        print("{0} : {1} 방향으로 날아갑니다.[속도 : {2}]"\
                .format(name, location, self.flying_speed))
        
# 날 수 있는 공격 유닛 클래스
class FlyableAttackUnit(AttackUnit, Flyable):
    def __init__(self, name, hp, damage, flying_speed):
        AttackUnit.__init__(self, name, hp, 0, damage) # 지상 speed는 0
        Flyable.__init__(self, flying_speed)

    def move(self, location):
        print("[공중 유닛 이동]")
        self.fly(self.name, location)

# 건물
class BuildingUnit(Unit):
    def __init__(self, name, hp, location):
        pass

# 서플라이 디폿 : 건물, 1개 건물 = 8 유닛
supply_depot = BuildingUnit("서플라이 디폿", 500, "7시")

def game_start():
    print("[알림] 새로운 게임을 시작합니다.")

def game_over():
    pass

game_start()
game_over()
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class OnUpKeyPress_Throw : MonoBehaviour
{
    // 플레이어 이동, 반전관련 변수선언
    public float speed = 5;
    float vx; // x축 이동량
    bool leftFlag = false; // 좌우반전
    bool upFlag = false; // 위쪽 방향키 눌렸는지 여부
    //프리팹 만들기------------------------------------
    public GameObject sushi; // 공장에 넘겨줄 원본(프리팹)
    GameObject newSushi; // 공장에 찍어낸 새로운 아이템(프리팹)
    //프리팹이 던져지는 위치와 힘을 지정
    public float offsetY = 1; // 프리팹이 던져지는 간격(Y축)
    public float throwX = 4;  // x축으로 던지는 힘
    public float throwY = 8;  // y축으로 던지는 힘

    // 메인카메라와 관련된 변수선언
    Vector3 camPos; // 카메라의 원래위치를 저장해두는 변수

    void Start()
    {
        // 카메라의 원래위치를 저장해둔다.
        camPos = Camera.main.transform.position;
    }

    void Update()
    {
        // 키보드 좌우방향키 입력 검사
        vx = 0; // 초기화

        if (Input.GetKey("right"))
        {
            vx = speed;
            leftFlag = false;
        }
        if (Input.GetKey("left"))
        {
            vx = -speed;
            leftFlag = true;
        }
    }

    void FixedUpdate()
    {
        // 플레이어 이동, 반전
        transform.Translate(vx / 50, 0, 0);
        GetComponent<SpriteRenderer>().flipX = leftFlag;

        if (Input.GetKey("up")) // 위쪽 키가 눌리면
        {
            if (upFlag == false)
            {
                upFlag = true;

                // 프리팹이 플레이어의 위치에 나오도록(프리팹이 나올 위치)
                Vector3 newPos = this.transform.position; // 현재 플레이어의 위치값
                newPos.y += offsetY; // 플레이어의 조금 위에
                newPos.z = -5; // 카메라의 앞에

                // 프리팹을 만들고, 프리팹이 나올 위치를 설정
                newSushi = Instantiate(sushi);
                newSushi.transform.position = newPos;

                // 프리팹 던지기(AddForce)
                Rigidbody2D rb = newSushi.GetComponent<Rigidbody2D>();

                if (leftFlag == true)
                {
                    rb.AddForce(new Vector2(-throwX, throwY), ForceMode2D.Impulse);
                }
                else
                {
                    rb.AddForce(new Vector2(throwX, throwY), ForceMode2D.Impulse);
                }
            }
        }
        else
        {
            upFlag = false;
        }
    }
    // 모든 오브젝트의 움직임이 끝난 후에 카메라를 이동시킨다.
    
    void LateUpdate()
    {
        // 일단 플레이어의 위치를 저장
        Vector3 playerPos = transform.position; // x, y, z

        // 그 플레이어의 위치를 카메라위치로 변경
        playerPos.z = -10; // 카메라의 위치값(z)
        playerPos.y = camPos.y; // 카메라의 원래 높이값
        Camera.main.transform.position = playerPos;
    }
}

'----------고1---------- > 게임엔진' 카테고리의 다른 글

[고1 게임엔진] 12 - (1)  (5) 2023.12.27
[고1 게임엔진] 11 - (2)  (2) 2023.11.20
[고1 게임엔진] 10 - (3)  (0) 2023.10.18
[고1 게임엔진] 10 - (2)  (2) 2023.10.16
[고1 게임엔진] 10 - (1)  (0) 2023.10.11
# 일반 유닛
class Unit:
    def __init__(self, name, hp, speed):
        self.name = name
        self.hp = hp
        self.speed = speed

    def move(self, location):
        print("[지상 유닛 이동]")
        print("{0} : {1} 방향으로 이동합니다. [속도 : {2}]"\
                .format(self.name, location, self.speed))
        
# 메딕 : 의무병(공격력 없음, 사람으로 된 유니싱 다쳤을 때 치료해주어 체력을 회복시켜 줌)
# 공격 유닛
class AttackUnit(Unit):
    def __init__(self, name, hp, speed, damage):
        Unit.__init__(self, name, hp, speed)
        self.damage = damage

    def attack(self, location):
        print("{0} : {1} 방향으로 적군을 공격합니다.[공격력 : {2}"\
                .format(self.name, location, self.damage))
        
    def damaged(self, damage):
        print("{0} : {1} 데미지를 입었습니다.".format(self.name, damage))
        self.hp -= damage
        print("{0} : 현제 체력은 {1} 입니다.".format(self.name, self.hp))
        if self.hp <= 0:
            print("{0} : 파괴되었습니다.".format(self.name))
    
# 드랍쉽 : 공중 유닛, 수송기, 마린/파이어뱃/탱크 등을 수송. 공격 불가
# 날 수 있는 기능을 가진 클래스
class Flyable:
    def __init__(self, flying_speed):
        self.flying_speed = flying_speed

    def fly(self, name, location):
        print("{0} : {1} 방향으로 날아갑니다.[속도 : {2}]"\
                .format(name, location, self.flying_speed))
        
# 날 수 있는 공격 유닛 클래스
class FlyableAttackUnit(AttackUnit, Flyable):
    def __init__(self, name, hp, damage, flying_speed):
        AttackUnit.__init__(self, name, hp, 0, damage) # 지상 speed는 0
        Flyable.__init__(self, flying_speed)

    def move(self, location):   # move 재정의
        print("[공중 유닛 이동]")
        self.fly(self.name, location)

# 벌처 : 지상 유닛, 기동성이 좋음
vulture = AttackUnit("벌쳐", 80, 10, 20)

# 배틀크루저 : 공중 유닛, 체력이 굉장히 좋음, 공격력도 좋음
battlecruiser = FlyableAttackUnit("배틀크루저", 500, 25, 3)

vulture.move("11시")
battlecruiser.fly("배틀크루저", "9시")
<!DOCTYPE html>
<html lang="ko">
    <head>
        <meta charset="utf-8">
        <title>외부 파일에 있는 자바스크립트 작성</title>
        <script src="lib.js">
        </script>
    </head>
    <body>
        <h3>마우스 올려 보세요</h3>
        <hr>
        <img src="banana.png" alt="이미지"
            onmouseover="over(this)"
            onmouseout="out(this)">
    </body>
</html>​
<!DOCTYPE html>
<html>
    <head>
        <title>이벤트 리스터 속성에 자바스크립트 코드</title>
    </head>
    <body>
        <h3>마우스 올려 보세요</h3>
        <hr>
        <img src="apple.png" alt="이미지"
            onmouseover="this.src='banana.png'"
            onmouseout="this.src='apple.png'">
    </body>
</html>
<!DOCTYPE html>
<html lang="ko">
    <head>
        <meta charset="utf-8">
        <title>script 태그에 자바스크립트 작성</title>
        <script>
            function over(obj) {
                obj.src="banana.png";
            }
            function out(obj) {
                obj.src="apple.png";
            }
        </script>
    </head>
    <body>
        <h3>마우스 올려 보세요</h3>
        <hr>
        <img src="apple.png" alt="이미지"
            onmouseover="over(this)"
            onmouseout="out(this)">
    </body>
</html>
<!DOCTYPE html>
<html lang="ko">
    <head>
        <meta charset="utf-8">
        <title>URL에 자바스크립트 작성</title>
    </head>
    <body>
        <h3>링크의 href에 자바스크립트 작성</h3>
        <hr>
        <a href="Javascript:alert('클릭하셨어요?')">클릭해보세요</a>
    </body>
</html>

lib.js

function over(obj) {
    obj.src="banana.png";
}
function out(obj) {
    obj.src="apple.png";
}
<!DOCTYPE html>
<html lang="ko">
    <head>
        <meta charset="utf-8">
        <title>document.write() 사용</title>
    </head>
    <body>
        <h3>document.write()로 HTML 콘텐츠 출력</h3>
        <hr>
        <script>
            document.write("<h3>Welcome!</h3>");
            document.write("2+5는 <br>");
            document.write("<mark>7 입니다.</mark>");
        </script>
    </body>
</html>

'----------고1---------- > 화면구현' 카테고리의 다른 글

[고1 화면구현] 11 - (2)  (0) 2023.11.21
[고1 화면구현] 10 - (4)  (0) 2023.10.26
[고1 화면구현] 10 - (3)  (0) 2023.10.19
[고1 화면구현] 10 - (2)  (1) 2023.10.10
[고1 화면구현] 10 - (1)  (0) 2023.10.05
# 일반 유닛
class Unit:
    def __init__(self, name, hp, speed):
        self.name = name
        self.hp = hp
        self.speed = speed

    def move(self, location):
        print("[지상 유닛 이동]")
        print("{0} : {1} 방향으로 이동합니다. [속도 : {2}]"\
                .format(self.name, location, self.speed))
        
# 메딕 : 의무병(공격력 없음, 사람으로 된 유니싱 다쳤을 때 치료해주어 체력을 회복시켜 줌)
# 공격 유닛
class AttackUnit(Unit):
    def __init__(self, name, hp, speed, damage):
        Unit.__init__(self, name, hp, speed)
        self.damage = damage

    def attack(self, location):
        print("{0} : {1} 방향으로 적군을 공격합니다.[공격력 : {2}"\
                .format(self.name, location, self.damage))
        
    def damaged(self, damage):
        print("{0} : {1} 데미지를 입었습니다.".format(self.name, damage))
        self.hp -= damage
        print("{0} : 현제 체력은 {1} 입니다.".format(self.name, self.hp))
        if self.hp <= 0:
            print("{0} : 파괴되었습니다.".format(self.name))
    
# 드랍쉽 : 공중 유닛, 수송기, 마린/파이어뱃/탱크 등을 수송. 공격 불가
# 날 수 있는 기능을 가진 클래스
class Flyable:
    def __init__(self, flying_speed):
        self.flying_speed = flying_speed

    def fly(self, name, location):
        print("{0} : {1} 방향으로 날아갑니다.[속도 : {2}]"\
                .format(name, location, self.flying_speed))
        
# 날 수 있는 공격 유닛 클래스
class FlyableAttackUnit(AttackUnit, Flyable):
    def __init__(self, name, hp, damage, flying_speed):
        AttackUnit.__init__(self, name, hp, 0, damage) # 지상 speed는 0
        Flyable.__init__(self, flying_speed)

    def move(self, location):   # move 재정의
        print("[공중 유닛 이동]")
        self.fly(self.name, location)

# 벌처 : 지상 유닛, 기동성이 좋음
vulture = AttackUnit("벌쳐", 80, 10, 20)

# 배틀크루저 : 공중 유닛, 체력이 굉장히 좋음, 공격력도 좋음
battlecruiser = FlyableAttackUnit("배틀크루저", 500, 25, 3)

vulture.move("11시")
# battlecruiser.fly("배틀크루저", "9시")
battlecruiser.move("10시")
# 일반 유닛
class Unit:
    def __init__(self, name, hp, speed):
        self.name = name
        self.hp = hp
        self.speed = speed

    def move(self, location):
        print("[지상 유닛 이동]")
        print("{0} : {1} 방향으로 이동합니다. [속도 : {2}]"\
                .format(self.name, location, self.speed))
        
# 메딕 : 의무병(공격력 없음, 사람으로 된 유니싱 다쳤을 때 치료해주어 체력을 회복시켜 줌)
# 공격 유닛
class AttackUnit(Unit):
    def __init__(self, name, hp, speed, damage):
        Unit.__init__(self, name, hp, speed)
        self.damage = damage

    def attack(self, location):
        print("{0} : {1} 방향으로 적군을 공격합니다.[공격력 : {2}"\
                .format(self.name, location, self.damage))
        
    def damaged(self, damage):
        print("{0} : {1} 데미지를 입었습니다.".format(self.name, damage))
        self.hp -= damage
        print("{0} : 현제 체력은 {1} 입니다.".format(self.name, self.hp))
        if self.hp <= 0:
            print("{0} : 파괴되었습니다.".format(self.name))
    
# 드랍쉽 : 공중 유닛, 수송기, 마린/파이어뱃/탱크 등을 수송. 공격 불가
# 날 수 있는 기능을 가진 클래스
class Flyable:
    def __init__(self, flying_speed):
        self.flying_speed = flying_speed

    def fly(self, name, location):
        print("{0} : {1} 방향으로 날아갑니다.[속도 : {2}]"\
                .format(name, location, self.flying_speed))
        
# 날 수 있는 공격 유닛 클래스
class FlyableAttackUnit(AttackUnit, Flyable):
    def __init__(self, name, hp, damage, flying_speed):
        AttackUnit.__init__(self, name, hp, 0, damage) # 지상 speed는 0
        Flyable.__init__(self, flying_speed)

    def move(self, location):   # move 재정의
        print("[공중 유닛 이동]")
        self.fly(self.name, location)

# 건물
class BuildingUnit(Unit):
    def __init__(self, name, hp, location):
        pass

# 서플라이 디폿 : 건물, 1개 건물 = 8유닛
supply_depot = BuildingUnit("서플라이디폿", 500, "7시")

def game_start():
    print("[알림] 게임을 시작합니다.")

def game_over():
    pass

game_start()
game_over()

1

<!DOCTYPE html>
<html>
    <head>
        <style>
            section {
                width:500px;
                padding:15px;
                border:5px solid gray;
            }
        </style>
    </head>
    <body>
        <section>
            <h2>Who am I?</h2>
            <p>프런트엔드 웹 기술(Front-end Web Tech.)에 관심이 많습니다.<br>
                현재 제주의 한 시골 마을에서 코딩 중입니다.</p>
        </section>
    </body>
</html>

 

2

<!DOCTYPE html>
<html>
    <head>
        <style>
            section {
                width:500px;
                padding:15px;
                border:5px solid gray;
            }
        </style>
        <link rel="stylesheet" href="style.css">
    </head>
    <body>
        <section>
            <h2>Who am I?</h2>
            <p>프런트엔드 웹 기술(Front-end Web Tech.)에 관심이 많습니다.<br>
                현재 제주의 한 시골 마을에서 코딩 중입니다.</p>
        </section>
    </body>
</html>

style.css

h2 {
    color : blue;
}

p {
    font-size:0.9em;
    line-height: 2.0;
}


3

<!DOCTYPE html>
<html>
    <body>
        <h1>블루베리와 항산화 효능</h1>
        <p style="color:blue;">블루베리는 항산화제인 안토시아닌과 폴리페놀을 다량 포함하고 있습니다.</p>
        <p>매사츄세츠 보스톤에 있는 USDA 노화에 관한 인류 영양 연구센터 (the USDA Human Nutrition Research Center on Aging) 의 자료에 의하면
            블루베리는 과일 중에서 가장 항산화 작용이 뛰어난 과일이라고 합니다.</p>
    </body>
</html>

 

4

<!DOCTYPE html>
<html>
    <head>
        <style>
            h2 {
                color:blue;
            }
            p {
                font-size:12px;
                margin-left:20px;
            }
        </style>
    </head>
    <body>
        <h1>블루베리에 관한 연구</h1>
        <h2>블루베리와 항산화 효능</h2>
        <p>블루베리는 항산화제인 안토시아닌과 폴리페놀을 다량 포함하고 있습니다.</p>
        <p>매사츄세츠 보스톤에 있는 USDA 노화에 관한 인류 영양 연구센터 (the USDA Human Nutrition Research Center on Aging) 의 자료에 의하면
            블루베리는 과일 중에서 가장 항산화 작용이 뛰어난 과일이라고 합니다.</p>
        <h2>블루베리와 노화</h2>
        <p>USDA 인류 영양 연구센터(the USDA Human Nutrition Research Center on Aging) 실험실에서 신경과학자들은 쥐들에게 블루베리를 먹임으로써
            노화에 의한 인지능력의 손실을 예방해 준다는 사실을 발견하였습니다.</p>
    </body>
</html>

 

5

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>셀렉터 만들기</title>
        <style>
            h3, li {
                color:brown;
            }
            div > div > strong {
                background-color: yellow;
            }
            ul strong {
                color:dodgerblue;
            }
            .warning {
                color: red;
            }
            body.main{
                background:aliceblue;
            }
            #list {
                background:mistyrose;
            }
            #list span {
                color:forestgreen;
            }
            h3:first-letter {
                color:red;
            }
            li:hover {
                background:yellowgreen;
            }
        </style>
    </head>
    <body class="main">
        <h3>Web Programming</h3>
        <hr>
        <div>
            <div>2학기<strong>학습 내용</strong>입니다.</div>
            <ul id="list">
                <li><span>HTML5</span></li>
                <li><strong>CSS</strong></li>
                <li>JAVASCRIPT</li>
            </ul>
            <div class="warning">60점 이하는 F!!</div>
        </div>
    </body>
</html>

 

6

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>텍스트 꾸미기</title>
        <style>
            h3 {
                text-align:right;
            }
            span {
                text-decoration:line-through;
            }
            strong {
                text-decoration: overline;
            }
            .p1 {
                text-indent: 3em;
                text-align: justify;
            }
            .p2 {
                text-indent: 1em;
                text-align: center;
            }
        </style>
    </head>
    <body>
        <h3>텍스트 꾸미기</h3>
        <hr>
        <p class="p1">HTML의 태그만으로 기존의 워드 프로세서와 같이 들여쓰기, 정렬, 공백,
            간격 등과 세밀한<span>텍스트 제어</span>를 할 수 없다.
        </p>
        <p class="p2">그러나, <strong>스타일 시트</strong>는 이를 가능하게 한다.
            들여쓰기, 정렬에 대해서 알아본다.
        </p>
        <a href="http://www.naver.com" style="text-decoration:none;">
            밑줄이 없는 네이버링크</a>
    </body>
</html>

 

7

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>박스모델</title>
        <style>
            body {
                background:ghostwhite;
            }
            span {
                background:deepskyblue;
            }
            div.box {
                background:yellow;
                border-style:solid;
                border-color:peru;
                margin:40px;
                border-width:30px;
                padding:20px;
            }
        </style>
    </head>
    <body>
        <div class="box">
            <span>DIVDIVDIV</span>
        </div>
    </body>
</html>

 

8

<!DOCTYPE html>
<html lang="ko">
    <head>
        <meta charset="utf-8">
        <title>박스모델</title>
        <style>
            div {
                background:yellow;
                padding:20px;
                border:5px dotted red;
                margin:30px;
            }
        </style>
    </head>
    <body>
        <h3>박스 모델</h3>
        <p>margin 30px, padding 20px, border 5px의 빨간색 점선</p>
        <hr>
        <div>
            <img src="mio.png" alt="고양이 눈">
        </div>
    </body>
</html>

 

9

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>이미지 테두리 만들기</title>
        <style>
            p {
                background:yellow;
                width:200px;
                height:60px;
                padding:10px;
                border:20px solid lightgray;
            }
            #round { border-image : url("border.png") 30 round; }
            #repeat { border-image : url("border.png") 30 repeat; }
            #stretch { border-image : url("border.png") 30 stretch; }
        </style>
    </head>
    <body>
        <h3>이미지 테두리 만들기</h3>
        <hr>
        다음은 원본 이미지입니다.<br>
        <img src="border.png" alt="원본">
        <hr>
        <p>20x20 크기의 회색 테두리를 가진 p태그</p>
        <p id="round">round 스타일 이미지 테두리</p>
        <p id="repeat">repeat 스타일 이미지 테두리</p>
        <p id="stretch">stretch 스타일 이미지 테두리</p>
    </body>
</html>

 

10

<!DOCTYPE html>
<html lang="ko">
<head>
    <meta charset="utf-8">
    <title>text-shadow와 box-shadow</title>
    <style>
        h2 {
            text-align: center;
            color : yellow;
            text-shadow : 2px 2px 3px blue;
        }
        img:hover {
            box-shadow : 0 0 5px blue;
        }
    </style>
</head>
<body>
    <h2>Most Visited Pages</h2>
    <hr>
    <table>
        <tr>
            <td><a href="http://www.naver.com">
                <img src="naver.png" width="120" height="100">
            </a></td>
            <td><a href="http://www.chosun.com">
                <img src="chosun.png" width="120" height="100">
            </a></td>
            <td><a href="http://www.amazon.com">
                <img src="amazon.png" width="120" height="100">
            </a></td>
        </tr>
    </table>
</body>
</html>

'----------고1---------- > 화면구현' 카테고리의 다른 글

[고1 화면구현] 11 - (2)  (0) 2023.11.21
[고1 화면구현] 11 - (1)  (0) 2023.11.09
[고1 화면구현] 10 - (3)  (0) 2023.10.19
[고1 화면구현] 10 - (2)  (1) 2023.10.10
[고1 화면구현] 10 - (1)  (0) 2023.10.05

[한글 맞춤법의 원리와 내용]

제1항

표준어를 ‘소리대로’ 적는다. + 어법에 맞도록 한다.

('하늘', '오리', '날다')

 

 

제2항

단어를 단위로 하여 띄어 쓴다. 다만 조사는 앞말에 붙여 쓴다.

('나 물 좀 줘.', '나는 너를 좋아해.')

 

 


 

 

제19항

어간에

'-이'나 '-음/-ㅁ'이 붙어 명사로 된 것과

'-이'나 '-히'가 붙어서 부사로 된 것은

어간의 원형을 밝히어 적는다.

(다듬다 ➜ 다듬이)

 

 

제19항 [붙임]

이외는 어간의 원형을 밝히어 적지 않는다.

(맞다 ➜ 마중)

 

 

제20항

명사에

'-이'가 붙어서 된 말은

명사의 원형을 밝히어 적는다.

(낱낱 ➜ 낱낱이)

 

 

제20항 [붙임]


이외는 명사의 원형을 밝히어 적지 않는다.

(잎 ➜ 이파리)

 

 


 

 

제41항

조사는 앞말에 붙여 쓴다.

(꽃, 꽃밖에, 꽃이나마)

 

 

제42항

의존 명사는 띄어 쓴다.

(아는 것이 힘이다. 나도 할 있다.)

 

 

제43항

단위 명사는 띄어 쓴다.

(차 여섯 , 옷 한 , 신 두 켤레)

 

 


 

 

 

 

[언어 공동체의 담화 관습이란 무엇인가]

갈래: 만화

성격: 설명적, 반성적, 교훈적

주제: 언어 공동체의 담화 관습의 의의와 수용 태도
    ① 만화의 형식 학습 ➜ 내용을 쉽고 재미있게 전달
    ② 옛사람들의 말을 인용 ➜ 과거의 담화 관습의 특징 제시

 

 

언어문화를 공유하는 집단에서 형성된 듣기·말하기의 방식이나 습관·태도 등을 언어 공동체의 담화 관습이라 한다.

오늘날 의사소통 문화를 바람직한 방향으로 발전시키려면 언어 공동체의 담화 관습을 비판적으로 수용해야 한다.

 

 

 

 


 

 

 

 

[가시리]

갈래: 고려가요
    3·3·2조 / 3음보
    분연체 (분단되어 있는 연)
    렴구, 여음구 (뜻이 없음, 운율과 흥추만 줌)

성격: 서정적, 민요적, 애상적

주제: 이별의 정한

특징
    ① 3·3·2조 / 3음보
    ② 분연체 - 각 연이 2행
    ③ 기-승-전-결의 구조
    ④ 반복 순우리말 시어, 간결, 애잔 가사

 

 

 

 

[진달래꽃]

갈래: 현대시, 자유시

성격: 전통적, 민요적, 애상적

주제: 이별의 정한

특징
    ① 이별의 상황 (가정)
    ② 전통적 정서 ➜ 3음보
    ③ 수미상관의 구조 (운율, 안정감, 주제 강조)
    ④ '~우리다' 종결 (운율, 음악적 효과)

 

 


 

 

[상춘곡]

갈래: 서정가사, 양반가사

성격: 서정적, 묘사적, 자연친화적

주제: 봄 경치를 감상하며 느낀 즐거움과 안빈낙도(가난해도 즐김)

특징
    ① 다양한 표현기법 + 설의법 (뻔한 질문)
    ② 공간에 따른 시상전개
    ③ 4음보의 율격, 마지막 행은 시조의 종장과 유사 ➜ "3글자" (아모타)

 

 

[울타리 밖]

갈래: 자유시, 서정시

성격: 서정적, 향토적, 자연친화적

주제: 천연한 자연과 인간이 조화된 아름다운 세계에 대한 소망
         자연과 인간이 어우러진 고향에 대한 그리움

특징
    ① 시각적 이미지 활용, 풍경 묘사 ➜ 회화성
    ② 동결한 연결 어미 '~듯' 반복 ➜ 동질적 속성
    ③ 하나의 시어 '천연히'로 독립적인 연 구성 ➜ 주제의식을 함축

 

 

[춘향전]