HI im starting a little game int net logo im trying to create some walls to appear randomly in the screen but i got this error, ill leave the code here thanks in advance
to setup
ca
let wall-down 20
let wall-position 5
let wall-up 10
let wd list n-values 5 random 5
(foreach wd [
ask patches
[
ifelse (pycor < ? - 16 and pxcor = wall-position )
[ set pcolor gray ]
[ set pcolor 97 ]
]
])
答案 0 :(得分:1)
这里你真的不需要foreach
和n-values
。写起来更简单:
to setup
clear-all
let wall-down 20
let wall-position 5
let wall-up 10
repeat 5 [
let y random 5
ask patches [
ifelse (pycor < y - 16 and pxcor = wall-position)
[ set pcolor gray ]
[ set pcolor 97 ]
]
]
end
无论如何你走n-values
路线,bergant对语法是正确的。