Hey I really would like to make a wakamole game for my school but I don’t know how to make the ground so sprites can come through and how to make a ground !!!
No I don’t mind but my code was only a demo of how to draw the moles and I suggest using @dave1707 's code as it is more suited to making an actual game
@Dantheman2001 you can use, to make a rectangle
rect
and
fill
to make it green. Sorry im on pc at the moment so cant make a example
Some code to get you started
function draw()
background(0, 0, 0, 255)
fill(0,255,0)
rect(0,HEIGHT/3*2,WIDTH,HEIGHT/3)
sprite("Planet Cute:Character Boy",WIDTH/3*0.5,HEIGHT/3*2+math.sin(ElapsedTime*4+WIDTH/3*0.5)*100)
sprite("Planet Cute:Character Boy",WIDTH/3*1.5,HEIGHT/3*2+math.sin(ElapsedTime*4+WIDTH/3*1.5)*100)
sprite("Planet Cute:Character Boy",WIDTH/3*2.5,HEIGHT/3*2+math.sin(ElapsedTime*4+WIDTH/3*2.5)*100)
rect(0,HEIGHT/3*1,WIDTH,HEIGHT/3)
sprite("Planet Cute:Character Boy",WIDTH/3*0.5,HEIGHT/3*1+math.sin(ElapsedTime*4+WIDTH/3*0.5)*100)
sprite("Planet Cute:Character Boy",WIDTH/3*1.5,HEIGHT/3*1+math.sin(ElapsedTime*4+WIDTH/3*1.5)*100)
sprite("Planet Cute:Character Boy",WIDTH/3*2.5,HEIGHT/3*1+math.sin(ElapsedTime*4+WIDTH/3*2.5)*100)
rect(0,HEIGHT/3*0,WIDTH,HEIGHT/3)
end
@Dantheman2001 Maybe this will give you an idea. Try to hit the beetle.
EDIT: Added hearts as a distraction.
displayMode(FULLSCREEN)
function setup()
spriteMode(CENTER)
tab={}
delay=.8
cnt=1
end
function draw()
background(40, 40, 50)
cnt=cnt+DeltaTime
if cnt>delay then
nx=math.random(7)
ny=math.random(10)
tab={}
for z=1,5 do
table.insert(tab,vec2(math.random(7),math.random(10)))
end
hit=false
cnt=0
delay=.8
end
for y=1,10 do
for x=1,7 do
sprite("Planet Cute:Grass Block",x*100,y*100,100)
end
end
if hit then
sprite("Tyrian Remastered:Explosion Huge",nx*100,ny*100-40)
else
sprite("Planet Cute:Enemy Bug",nx*100,ny*100-15,70)
for a,b in pairs(tab) do
sprite("Planet Cute:Heart",b.x*100,b.y*100-15,70)
end
end
end
function touched(t)
if t.state==BEGAN then
hit=false
for y=1,10 do
for x=1,10 do
if t.x>x*100-50 and t.x<x*100+50 and
t.y>y*100-50 and t.y<y*100+50 then
if x==nx and y==ny then
hit=true
delay=.8
cnt=0
end
end
end
end
end
end