making short games, learning how to make longer ones too
- games: pancelor.itch.io/
- website/blog/etc: pancelor.com/
```
hit_obj = try_move(dx,dy)
if hit_obj then
try_push(hit_obj,dx,dy)
end
```
but instead:
```
try_move(dx,dy)
try_push(dx,dy)
```
I feel a bit bad checking for obstacles twice, but its _so_ good for keeping the complexity demons out
```
hit_obj = try_move(dx,dy)
if hit_obj then
try_push(hit_obj,dx,dy)
end
```
but instead:
```
try_move(dx,dy)
try_push(dx,dy)
```
I feel a bit bad checking for obstacles twice, but its _so_ good for keeping the complexity demons out
interesting point about tostr()->"". here's lua 5.4:
> function f(x) if x>0 then return x end end
> tostring(f(10))
10
> tostring(f(-4))
<error>
I can't decide whether to be horrified or not haha. I think I like your way better!
interesting point about tostr()->"". here's lua 5.4:
> function f(x) if x>0 then return x end end
> tostring(f(10))
10
> tostring(f(-4))
<error>
I can't decide whether to be horrified or not haha. I think I like your way better!
```
function strwidth(str)
local x,y=?str, 0, 10000
printh(tostr(x).." "..tostr(y))
return x,y
end
strwidth("²7⁶y5sTART")
```
this prints (to host console) `7y5sTART nil` (??)
```
function strwidth(str)
local x,y=?str, 0, 10000
printh(tostr(x).." "..tostr(y))
return x,y
end
strwidth("²7⁶y5sTART")
```
this prints (to host console) `7y5sTART nil` (??)
```
function strwidth(str)
x,y=print(str, 0, 10000)
printh(tostr(x).." "..tostr(y))
return x,y
end
strwidth("hi")
```
this prints `nil nil` when run inside a cart, should be `23 10011` instead
```
function strwidth(str)
x,y=print(str, 0, 10000)
printh(tostr(x).." "..tostr(y))
return x,y
end
strwidth("hi")
```
this prints `nil nil` when run inside a cart, should be `23 10011` instead
also, `print(nil)` doesn't work unless I change the early-out condition to `if (select("#",...) == 0)`
also, `print(nil)` doesn't work unless I change the early-out condition to `if (select("#",...) == 0)`