お名前、学年、お住まいの地域、好きなこと、興味のあること、やりたいこと、など
load #novita_wally-0
--set env
poke(0x5f5c,255)
--init variables
collect = 1
x = (128-8)/2
y = (128-8)/2
function _draw()
--clear screen
cls(3)
--draw map
map(0,0)
--collect view
rectfill(0,0,11,11,12)
rect(0,0,11,11,7)
spr(collect,2,2)
-- cursor
spr(0,x,y)
if btn(⬅️) then
x -= 1
end
if btn(➡️) then
x += 1
end
if btn(⬆️) then
y -= 1
end
if btn(⬇️) then
y += 1
end
--check item
if btn(🅾️) then
print(mget((x+4)/8,(y+4)/8),4,16)
end
if btnp(🅾️) then
clicked = mget((x+4)/8,(y+4)/8)
if clicked == collect then
--collect
sfx(0)
spr(16,
flr((x+4)/8)*8-4,
flr((y+4)/8)*8-4,
2,2)
else
--incollect
if fget(clicked,0) then
sfx(1)
mset((x+4)/8,(y+4)/8,15)
end
end
end
end
--set env
poke(0x5f5c,255)
--init variables
collect = 1
x = (128-8)/2
y = (128-8)/2
function _init()
--collect and others sepalate
mtable = {}
for i=0, 255 do
if fget(i, 0) then
add(mtable, i)
end
end
collect = rnd(mtable)
del(mtable, collect)
--fill map by others
for i=0,15 do
for j=0,15 do
if
not(i==0 and j==0) and
not(i==0 and j==1) and
not(i==1 and j==0) and
not(i==1 and j==1)
then
if rnd() < 0.2 then
mset(j,i,rnd(mtable))
end
end
end
end
--put collect on map
local cx = 0
local cy = 0
while
(cx==0 and cy==0) or
(cx==0 and cy==1) or
(cx==1 and cy==0) or
(cx==1 and cy==1)
do
cx = flr(rnd(16))
cy = flr(rnd(16))
end
mset(cx,cy,collect)
end
function _draw()
--clear screen
cls(3)
--draw map
map(0,0)
--collect view
rectfill(0,0,11,11,12)
rect(0,0,11,11,7)
spr(collect,2,2)
-- cursor
spr(0,x,y)
if btn(⬅️) then
x -= 1
end
if btn(➡️) then
x += 1
end
if btn(⬆️) then
y -= 1
end
if btn(⬇️) then
y += 1
end
--check item
if btn(🅾️) then
print(mget((x+4)/8,(y+4)/8),4,16)
end
if btnp(🅾️) then
clicked = mget((x+4)/8,(y+4)/8)
if clicked == collect then
--collect
sfx(0)
spr(16,
flr((x+4)/8)*8-4,
flr((y+4)/8)*8-4,
2,2)
else
--incollect
if fget(clicked,0) then
sfx(1)
mset((x+4)/8,(y+4)/8,15)
end
end
end
end
load #novita_pingpong-0
--set env
poke(0x5f5c, 255)
--init variables
player_points = 0
com_points = 0
scored = ""
sp = 0
sp_max = 5
-- restart game
function _init()
--sp flag
f_sp = 0
--player data
player = {
x = 8,
y = 63,
c = 12,
w = 2,
h = 10,
speed = 1
}
--com data
com = {
x = 117,
y = 63,
c = 8,
w = 2,
h = 10,
speed = 0.75
}
--ball data
ball = {
x = 63,
y = 63,
c = 7,
w = 2,
dx = 0.6,
dy = (flr(rnd(2)) - 0.5)*1,
speed = 1,
speedup = 0.05
}
--court
court = {
left = 0,
right = 127,
top = 10,
bottom = 127,
center = 63,
line = {
y = 10,
length = 4
}
}
--sound
if scored == "player" then
sfx(3)
elseif scored == "com" then
sfx(4)
else
sfx(5)
end
end
function _update60()
-- player controls
if btn(⬆️) and player.y > court.top + 1 then
player.y -= player.speed
end
if btn(⬇️) and player.y + player.h < court.bottom - 1 then
player.y += player.speed
end
--computer controls
com.mid = com.y + com.h / 2
if ball.dx > 0 then
--forward to com
if com.mid > ball.y and flr(com.y) > court.top + 1 then
com.y -= com.speed
end
if com.mid < ball.y and com.y + com.h < court.bottom - 1 then
com.y += com.speed
end
else
--far from com
if com.mid > 73 then
com.y -= com.speed
end
if com.mid < 53 then
com.y += com.speed
end
end
--collide with com
if ball.dx > 0
and ball.x + ball.w >= com.x
and ball.x + ball.w <= com.x + com.w
and ball.y >= com.y
and ball.y + ball.w <= com.y + com.h
then
ball.dx = -(ball.dx + ball.speedup)
sfx(0)
end
--collide with player
if ball.dx < 0
and ball.x + ball.w >= player.x
and ball.x <= player.x + player.w
and ball.y + ball.w >= player.y
and ball.y <= player.y + player.h
then
--control ball
if btn(⬆️) then
ball.dy -= ball.speedup * 5
end
if btn(⬇️) then
ball.dy += ball.speedup * 5
end
--charge sp gauge
if f_sp == 0 then
sp += 1
end
if sp > sp_max then
sp = sp_max
end
ball.dx = -(ball.dx + ball.speedup)
sfx(1)
end
--collide with court
if ball.y + ball.w >= court.bottom -1
or ball.y <= court.top + 1
then
ball.dy = -ball.dy
sfx(2)
end
--ball movement
if f_sp > 0 and ball.dx > 0 then
ball.x += ball.dx * 2
ball.y += ball.dy * 2
else
ball.x += ball.dx
ball.y += ball.dy
end
--score
if ball.x > court.right then
player_points += 1
scored = "player"
_init()
end
if ball.x < court.left then
com_points += 1
scored = "com"
_init()
end
--fire sp
if sp == sp_max and btnp(🅾️) then
f_sp = 600
sp = 0
end
--abort sp
if f_sp > 0 then
f_sp -= 1
end
end
function _draw()
--clear screen
cls()
--draw court
rect(0,10,127,127,6)
--dashed center line
repeat
line(court.center,court.line.y,court.center,court.line.y+court.line.length,11)
court.line.y += court.line.length*2
until court.line.y > court.bottom
court.line.y = 10 --reset
--ball
rectfill(
ball.x, ball.y,
ball.x+ball.w, ball.y+ball.w,
ball.c
)
--player
rectfill(
player.x, player.y,
player.x+player.w, player.y+player.h,
player.c
)
--computer
rectfill(
com.x, com.y,
com.x+com.w, com.y+com.h,
com.c
)
--score
print(player_points, 30,2,player.c)
print(com_points, 95,2,com.c)
--sp gauge
if f_sp > 0 then
--sp mode
rectfill(63-10,3,63-10+20/600*f_sp,5, 9)
else
--normal mode
if sp > 0 then
rectfill(63-10,3,63-10+4*sp,5, player.c)
end
end
rect(63-10-1,2,63+10+1,6,5)
end
以下のQRコードからキャンプのアンケートにご回答ください