General area when it fits no where else

Moderator: Mmiscool

User avatar
By Mmiscool
#60932 Hello,

Some one approached me wanting to do a little class at the local maker space near me.

He wanted to use the OLED screen and some push buttons to make a game that can be played on the esp using esp basic.

I started to thow some code together but some one else out there might have already done it or is better at game logic than me.

If any one is interested and has a small game to share I would be very interested.

-Mike

Code: Select alltextbox bla$

interrupt d5, [left]
interrupt d6, [right]
timer 500, [move]
wait


[left]
if io(laststat,d5) = 0 then wait
bla$ = "left"
x = x - 1
goto [display]

[right]
if io(laststat,d6) = 0 then wait
bla$ = "right"
x = x + 1
goto [display]



[move]

GapPos = GapPos + 1
if GapPos >= 11 then GapPos = 1

[display]
oled.cls()
if x >= 11 then x = 11
if x <= 0 then x = 1
oled.rect.fill(x*10,25,10,10)

oled.rect.fill(GapPos * 10,15,10,10)
wait

User avatar
By Boxey
#60958 Might not be of any use as it's Lua script based, but looking at the Lua script it doesn't seem it would be too difficult to port over to Basic (removing all the clock display and time update code would make it quite a small program to use as a good starting point).

Video: https://www.youtube.com/watch?v=Su3f5w3nEbg

Source code: https://github.com/kubi57/ESP8266/tree/ ... pong-clock

Would have to add a couple of buttons to control the movement too


There seems to be a few "pong" games out there which run on the ESP ..but unfortunately all in C or Lua