猫史档案馆


小熊与雪

小熊与雪

Lv.1

努力是桨,梦想是帆,在大海中乘风破浪,总有一天,会到达梦想的彼岸

获赞:836收藏:636浏览:20576作品收藏:91

签名:师傅:YLS汤圆 正在向师傅学习……(非“诚”勿扰) 九月目标: 点赞:900 收藏:6500 冲进阶高手(点赞分还差40)

回复帖子评论
上一页6 页 / 共 6下一页

拜师!!! 中回复

喵d

2021-07-19T15:26:50 点赞:0

不用F12就可以的无字天书! 中回复

  

2021-07-19T15:27:48 点赞:0

求求了~~~ 中回复

好像跑酷类的水(得)作(赞)品(多)doge

2021-07-24T08:54:49 点赞:0

【跟风倒数】 中回复

2021-07-27T16:53:44 点赞:0

用一句话证明你是官方! 中回复

本工作室不参与任何工作室的活动比拼,也不加任何训练师.

2021-07-28T17:04:30 点赞:2

用一句话证明你是官方! 中回复

活动活动活动喵喵喵住在源码世界的猴急一枚最爱的食物是:电池(因为可以发电) 神奇代码岛官网:box3.fun!加入官方内测唯一QQ喵   

2021-07-28T17:05:25 点赞:0

跳跃怎么做得更丝滑 中回复

我的作品中有,帮你开源了啊~
https://shequ.codemao.cn/work/109609481

2021-08-16T17:10:27 点赞:0

小柴找师傅(急) 中回复

路过

2021-08-16T17:23:48 点赞:0

我的知名度(doge) 中回复

111 ~

2021-08-16T17:37:22 点赞:0

岛3求助!!! 中回复

给玩家创建一个属性:(上次高度)

world.onPlayerJoin(({entity})=>{
    entity.lastH = entity.position.y
}

每次tik遍历玩家列表,判断是否着地

world.onTick(({}) => {
    let players = world.querySelectorAll('player')
    for (p in players){
        if (p.moveState!= 'fall'{
            if (p.lastH - p.position.y >= 5){//填下落规定高度
                p.lastH = p.position.y
                p.hp -= 20
            }
        } 
    }
});

2021-08-16T17:54:53 点赞:0

【求助】如何使玩家自己选择背景音乐 中回复

编程猫?代码岛?

2021-08-16T18:06:09 点赞:0

想问一下怎么样能让计时器在编辑状态下也隐藏 中回复

最好的办法就是把他缩小到你看不见,游戏中用角色显示计时会比用计时器效果更好哦~

2021-08-16T18:12:11 点赞:0

哇!F12真的好厉害啊! 中回复

Ctrl+U

2021-08-16T18:25:16 点赞:0

求加入小小神射手工作室 中回复

有一个破50赞的非互赞原创作品,或师徒关系被引荐可以加入我们哦~

2021-08-16T18:37:44 点赞:0

求能一起编程的朋友(qaq) 中回复

交盆友

2021-08-16T18:41:24 点赞:0

跑酷复活点代码怎么搞,急!!!! 中回复

box3?

2021-08-16T18:45:00 点赞:0

找一个休闲类作品寻找灵感,我的确没有灵感了。。。 中回复

我有一些……

2021-08-17T15:19:48 点赞:0

我对关于广告刷屏的看法 中回复

就是特别烦标注了已赞的人……

2021-08-17T15:27:52 点赞:0

谁有灵感啊 中回复

……imgsrc="https://static.codemao.cn/emoji/codemao/%E7%BC%96%E7%A8%8B%E7%8C%AB_%E5%86%B7%E6%BC%A0.gif"alt="emotion_编程猫_冷漠"跑酷类的肿么样?

2021-08-17T15:46:17 点赞:0

python作品大集合!! 中回复

#初始化游戏
import pygame
import sys
import random
import time
pygame.init() 
canvas = pygame.display.set_mode((480, 852))
pygame.display.set_caption("飞机大战")
canvas.fill((255, 255, 255))
#导入图片
bg = pygame.image.load("images/bg1.png")
enemy1 = pygame.image.load("images/enemy1.png")
enemy2 = pygame.image.load("images/enemy2.png")
enemy3 = pygame.image.load("images/enemy3.png")
h = pygame.image.load("images/hero.png")
b = pygame.image.load("images/bullet1.png")
stop = pygame.image.load("images/game_pause_nor.png")
LOGO = pygame.image.load("images/LOGO.png")
startGame = pygame.image.load("images/startGame.png")
#鼠标退出函数
def isMouseOut(x,y):
    if x>479 or x<=0 or y>=喵9 or y<=0:
        return True
    else:
        return False
def isMouseOver(x, y):
    if x > 1 or x <= 479 or y > 1 or y < 喵9:
        return True
    else:
        return False
#退出函数
def handleEvent():
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            sys.exit()
        if event.type == pygame.MOUSEMOTION:
            GameVar.hero.x = event.pos[0]-GameVar.hero.width/2
            GameVar.hero.y = event.pos[1]-GameVar.hero.height/2
            if isMouseOut(event.pos[0], event.pos[1]):
                if GameVar.state == GameVar.STATES['RUNNING']:
                    GameVar.state = GameVar.STATES['PAUSE']
            if isMouseOver(event.pos[0], event.pos[1]):
                if GameVar.state == GameVar.STATES['PAUSE']:
                    GameVar.state = GameVar.STATES['RUNNING']
        if event.type==pygame.MOUSEBUTTONDOWN and event.button==1:
            if GameVar.state == 1:
                GameVar.state = GameVar.STATES['RUNNING']
#时间间隔函数
def isActionTime(lastTime,insert):
    if lastTime == 0:
        return True
    newTime = time.time()
    return newTime - lastTime >= insert
#碰撞函数
def bong(a,b):
    if a.x > b.x-a.width and a.x < b.x+a.width+b.width and a.y > b.y-a.height and a.y < b.y+a.height+b.height:
        return True
    else:
        return False
#背景类
class Bg():
    width = 480
    height = 852
    def __init__(self):
        self.img = bg
        self.x1 = 0
        self.x2 = 0
        self.y1 = 0
        self.y2 = -Bg.height
    def step(self):
        self.y1 = self.y1+1
        self.y2 = self.y2+1
        if self.y1 > Bg.height:
            self.y1 = -Bg.height
        if self.y2 > Bg.height:
            self.y2 = -Bg.height
    def paint(self):
        canvas.blit(self.img, (self.x1, self.y1))
        canvas.blit(self.img, (self.x2, self.y2))
#敌机类
class Enemy():
    def __init__(self,x,y,width,height,life,score,img):
        self.x = x
        self.y = y
        self.width = width
        self.height = height
        self.life = life
        self.score = score
        self.img = img
    def paint(self):
        canvas.blit(self.img,(self.x,self.y))
    def step(self):
        self.y = self.y + 2
#英雄类
class Hero():
    def __init__(self,x,y,width,height,life,img):
        self.width = width
        self.height = height
        self.x = (Bg.width+self.width)/2
        self.y = (Bg.height+self.height)/2
        self.life = life
        self.img = img
        self.shootLastTime = 0
        self.shootInsert = 0.3
    def paint(self):
        canvas.blit(self.img, (self.x, self.y))
    def shoot(self):
        if isActionTime(self.shootLastTime, self.shootInsert):
            self.shootLastTime = time.time()
            GameVar.bullets.append(Bullet(self.x+(self.width-9)/2, self.y-21, 9, 21, 1, b))
#子弹类
class Bullet():
    def __init__(self, x, y, width, height, life, img):
        self.width = width
        self.height = height
        self.x = x
        self.y = y
        self.life = life
        self.img = img
    def paint(self):
        canvas.blit(self.img, (self.x, self.y))
    def step(self):
        self.y = self.y - 2
#游戏数据类
class GameVar():
    #创建背景角色
    sky = Bg()
    #创建敌机列表
    enemies = []
    #敌机创建时间
    enemyLastTime = 0
    enemyInsert = 1
    #飞行物重绘时间
    allLastTime = 0
    allInsert = 0.04
    #英雄机
    hero = Hero(0,0,60,75,1,h)
    #创建子弹列表
    bullets = []
    #分数生命
    score = 0
    life = 1
    #游戏状态
    STATES ={'STATE':1,'RUNNING':2,'PAUSE':3,'GAME_OVER':4}
    state = STATES['STATE']
#添加所有图片函数
def allEnter():
    #添加飞机
    if isActionTime(GameVar.enemyLastTime, GameVar.enemyInsert):
        GameVar.enemyLastTime = time.time()
        a = random.randint(1,100)
        x1 = random.randint(0, Bg.width-57)
        y1 = -45
        x2 = random.randint(0, Bg.width-50)
        y2 = -68
        x3 = random.randint(0, Bg.width-100)
        y3 = -153
        if a >= 95:
            GameVar.enemies.append(Enemy(x3, y3, 100, 153, 10, 5, enemy3))
        elif a >= 80:
            GameVar.enemies.append(Enemy(x2, y2, 50, 68, 5, 3, enemy2))
        else:
            GameVar.enemies.append(Enemy(x1, y1, 57, 45, 3, 1, enemy1))
    #添加子弹
    GameVar.hero.shoot()
#写文字方法
def text(text,position,big):
    my_font = pygame.font.SysFont("微软雅黑",big)
    newText = my_font.render(text,True,(255,255,255))
    canvas.blit(newText,position)
#画所有图片函数
def allPaint():
    GameVar.sky.paint()
    for enemy in GameVar.enemies:
        enemy.paint()
    GameVar.hero.paint()
    for b in GameVar.bullets:
        b.paint()
    text('score:'+str(GameVar.score),(0,0),40)
    text('life:'+str(GameVar.life), (380, 0),40)

#移动所有图片函数
def allStep():
    GameVar.sky.step()
    for enemy in GameVar.enemies:
        enemy.step()
        if enemy.y > Bg.height:
            GameVar.enemies.remove(enemy)
        for b in GameVar.bullets:
            if bong(enemy,b):
                GameVar.bullets.remove(b)
                enemy.life -= 1
                if enemy.life <= 0:
                    GameVar.score += enemy.score
                    GameVar.enemies.remove(enemy)
        if bong(enemy,GameVar.hero):
            GameVar.enemies.remove(enemy)
            GameVar.life-=1
            if GameVar.life <= 0:
                GameVar.state = GameVar.STATES['GAME_OVER']
    for b in GameVar.bullets:
        b.step()
        if b.y < 0:
            GameVar.bullets.remove(b)
#运行函数
def gameUp():
    if GameVar.state == 1:
        GameVar.sky.paint()
        GameVar.sky.step()
        canvas.blit(LOGO,(-40,200))
        canvas.blit(startGame,(150,400))
    elif GameVar.state == 2:
        allStep()
        allPaint()
        allEnter()
    elif GameVar.state == 3:
        allPaint()
        canvas.blit(stop,(Bg.width/2,Bg.height/2))
    else:
        GameVar.sky.paint()
        GameVar.sky.step()
        text('GameOver',(60,320),100)

while True:
    gameUp()
    pygame.display.update()
    handleEvent()

2021-08-17T15:58:02 点赞:0

求助。作品自荐后多久才审核,审核后如何知道? 中回复

如果两周都没消息基本是没希望了

2021-08-17T16:07:01 点赞:0

为什么在线人数一直是2(我还在编程,没有发布) 中回复

系统判断了编辑者(你自己)与游玩者(你自己)……

2021-08-18T11:50:48 点赞:0

这是什么啊 中回复

github?

2021-08-18T16:08:40 点赞:1

哔哔哔,求帮忙。这是我希望的:【右键,选项,点击长喵,角色会拿上长喵】 中回复

world.onPress(({ button, entity }) => {
    if(button === 'action1'){
        let selection=entity.player.dialog({
            type: Box3DialogType.SELECT,
            title: '武器',
            content: `你好,${entity.player.name},这里可以切换手持的武器`,
            opti喵:['长枪']
        })
        if (selection){
            c喵t wuqi=wuqilist[selection.index]
            if (wuqi='长枪'){
                entity.player.addWearable({
                    bodyPart: Box3BodyPart.RIGHT_HAND,
                    mesh: 'mesh/长枪 加强版.vb',
                    orientation: new Box3Quaternion(0,1,0,0).rotateY(Math.PI),
                    offset: new Box3Vector3(-0.05,-0.1,0.5),
                    scale: Box3Vector3 = new Box3Vector3(0.5, 0.5, 0.5)
                    
                })
            }
        }
    }
})

2021-08-18T16:22:51 点赞:0

scratch它又能用了!! 中回复

scratch2.jsitl.com/ide/ 是吗?

2021-09-21T10:09:32 点赞:0

【莺浪工作室】@汤圆 关于本工作室新网址协议 中回复

center_image

2022-02-10T21:06:04 点赞:1