-- title: megamegamang -- author: pixelbath -- desc: in a world...where one robot, uh...thing. helps people? by shooting lots of robot enemies -- site: website link -- license: MIT License (change this to your license of choice) -- version: 0.1 -- script: lua t=0 local player_walk_speed = 1 local player_slide_speed = 2 local player_fire_cooldown = 3 local player_bullet_speed = 5 local player = { x=110, y=80, yvel=0, spr=0, spr_base=256, flip=0, cnt_run=0, cnt_fire=0, cdn_fire=0, cdn_auto_fire=0, frames_run={258,260,262,260}, frame_slide=266, bullets={}, is_jumping=false, jump_button_held=false, cnt_slide=0, } function BOOT() player.spr=player.spr_base end function update() local is_running = false if btn(1) and btn(5) then if not player.is_jumping then player.cnt_slide = 30 end end if btn(2) then player.cnt_run = player.cnt_run + 1 player.flip = 1 is_running = true player.x = player.x - player_walk_speed end if btn(3) then player.cnt_run = player.cnt_run + 1 player.flip = 0 is_running = true player.x = player.x + player_walk_speed end if btn(4) then if player.cdn_fire <= 0 or player.cdn_auto_fire <= 0 then player.cnt_fire = 10 player.cdn_fire = player_fire_cooldown player.cdn_auto_fire = player_fire_cooldown + 20 spawn_bullet() end else player.cnt_fire = player.cnt_fire - 1 player.cdn_fire = player.cdn_fire - 1 end player.cdn_auto_fire = player.cdn_auto_fire - 1 if btn(5) then if player.is_jumping == false and player.jump_button_held == false then player.yvel = -4.4 player.is_jumping = true player.jump_button_held = true end else if player.is_jumping and player.yvel < -2.1 then player.yvel = -1.2 end player.jump_button_held = false end -- TODO: actual collision player.y = player.y + player.yvel if player.y < 80 then if player.yvel < 12 then player.yvel = player.yvel + 0.25 end else player.yvel = 0 player.y = 80 player.is_jumping = false end -- reset run counter if not pressing a button if not is_running then player.cnt_run = 0 end local spr_offset = 0 if player.cnt_run > 0 then spr_offset = ((player.cnt_run // 6) % 4) + 1 player.spr = player.frames_run[spr_offset] else player.spr = player.spr_base end if player.is_jumping then player.spr = 264 end if player.cnt_fire > 0 then player.spr = player.spr + 32 end for key, bullet in ipairs(player.bullets) do player.bullets[key].x = bullet.x + bullet.spd if bullet.x < -8 or bullet.x > 248 then table.remove(player.bullets, key) end end end function spawn_bullet() local bullet_speed = player_bullet_speed local bullet_x = player.x + 11 if player.flip == 1 then bullet_speed = bullet_speed * -1 bullet_x = player.x end bullet = { x = bullet_x, y = player.y+7, spd = bullet_speed, spr = 286, } table.insert(player.bullets, bullet) end function draw_player(colorkey) spr(player.spr, player.x, player.y, colorkey, 1, player.flip, 0, 2, 2) local flash_offset = 2 if player.spr == 290 or player.spr == 294 then flash_offset = 3 end if player.cnt_fire > 8 then if player.flip == 1 then spr(270, player.x, player.y+flash_offset, colorkey, 1, player.flip) else spr(270, player.x+8, player.y+flash_offset, colorkey, 1, player.flip) end end -- draw bullets for key, bullet in ipairs(player.bullets) do spr(bullet.spr, bullet.x, bullet.y, colorkey, 1) end end function TIC() update() cls(7) draw_player(5) line(0, 96, 240, 96, 0) rect(0, 97, 240, 6, 4) line(0, 103, 240, 103, 12) t=t+1 end -- -- 000:55555000555500bb55500a99555099995550b9995550b99455500b9455550099 -- 001:00555555b0055555ab00555599a05555bb905555f49055554400555540055555 -- 002:5555555555555000555500bb55500a99555099995550b9995550b99450000b94 -- 003:5555555500555555b0055555ab00555599a05555bb905555f490555544000555 -- 004:55555000555500bb55500a99555099995550b9995550b99455500b9455550099 -- 005:00555555b0055555ab00555599a05555bb905555f49055554400555540055555 -- 006:5555555555555000555500bb55500a99555099995550b9995550b99455000b94 -- 007:5555555500555555b0055555ab00555599a05555bb905555f490555544005555 -- 008:55555000555500bb50000a9950990999509909995099b99450099b945500bb99 -- 009:00555555b0055555ab000055990aa055bb999055f4999055449900554bb00555 -- 010:5555555555555555555555555555555555555555555000005500bbb050099abb -- 011:5555555555555555555555555555555555555555555555550555555500005555 -- 012:55089000550990ab5509b9bb550b99bb550bb9aa5500b99955509b9955500b99 -- 013:00555555a00555559a0055559990555599b0555599b005559b9905559b990555 -- 014:555555555ab555555cb5555555b555555c5555555555bc555555abc555555b55 -- 015:5ff55555fccf5555fccf55555ff5555555555555555555555555555555555555 -- 016:55000bbb5509b0bb5509909955099b99550000bb555009995550999955509988 -- 017:bb000555b0b90555909905559b990555b00005559a0555559900555599a05555 -- 018:509bbb9950990bbb509900bb5500bb995009ab9b509999095000000955555508 -- 019:40990555b0990555bbb0055500005555aa055555990555559900555599a05555 -- 020:55500bbb5550b0bb5550b99955509999555099bb555099995550909955500089 -- 021:b0555555b005555599055555b9055555a005555590555555900555559a055555 -- 022:5009bbb9509b0bbb509900bb50000b99009abb99099999000009900055000050 -- 023:40055555b9905555b990555500055555bba05555999055559990555589990555 -- 024:55500bbb555500bb5555009955550b9955550bb055009ab05509990555099805 -- 025:bb005555b00555559bb005559bba055509990555099905550999a05500000055 -- 026:5099999950b999bb50b994f4550b94445000994b509bbbbb00990bb909980099 -- 027:99a055559b9005559b990055b999a055bb99900099b999a09bb9999090089900 -- 028:555500bb555550bb5555009955550b9955500bb0555099b05550989055508880 -- 029:bbb90555bb005555abba05559999055508890555089905555099055550000555 -- 030:5fff5555fcccf555fcccf5555fff555555555555555555555555555555555555 -- 031:55ffff555f5555f5f55ff55ff5fccf5ff5fccf5ff55ff55f5f5555f555ffff55 -- 032:55555000555500bb55500a99555099995550b9995550b99455500b9455509b99 -- 033:00555555b0055555ab00555599905555bb905555f49055554400000540009a00 -- 034:5555555555555000555500bb55500a99555099995550b9995550b99450000b94 -- 035:5555555500555555b0055555ab00555599905555bb905555f490555544000005 -- 036:55555000555500bb55500a99555099995550b9995550b99455500b9455550099 -- 037:00555555b0055555ab00555599905555bb905555f49055554400000540009a00 -- 038:5555555555555000555500bb55500a99555099995550b9995550b99455500b94 -- 039:5555555500555555b0055555ab00555599905555bb905555f490555544000005 -- 040:55555000555500bb50000a9950990999509909995099b99450099b945500bb99 -- 041:00555555b0055555ab00555599905555bb905555f4905555440000054b009a00 -- 042:55555000555500bb55500a99555099995550b9995550b99455500b9455550099 -- 043:00555555b0055555ab00555599a05555bb905555349055554400555540055555 -- 044:55099000550990bb5509bb99550bb999550b9bb955009bb95550b9bb55500b99 -- 045:00555555b0055555ab055555990055559bb05555f490000544009a009bb999a0 -- 046:5fffff55faafaaf5fafbfaf5faafaaf55fffff55555555555555555555555555 -- 047:5555555555555555555555555555555555555555555555555555555555555555 -- 048:5550bbbb555099bb555099995550bb9955509b9b550099005509990555099805 -- 049:bbb999a0b00b990000500005bb005555bba055559990555599900555899a0555 -- 050:509bbb9950990bbb509900bb5500bb995009ab9b509999095000000955555508 -- 051:40009a00bbb999a0b000990000550005aa055555990555559900555599a05555 -- 052:55500bbb5550b0bb5550b99955509999555099bb555099995550909955500089 -- 053:bbb999a0b000990090550005b9055555a005555590555555900555559a055555 -- 054:55550bb955550bbb555550bb50000b99009abb99099999000009900055000050 -- 055:40009a00b99999a0b990990000050005bba05555999055559990555589990555 -- 056:55500bbb555500bb5555509955550b9955550bb055009ab05509990555099805 -- 057:bbb999a0b00099009bb000059bba055509990555099905550999a05500000055 -- 058:55000bbb5509b0bb5509909955099b99550000bb555009995550999955509988 -- 059:bb000555b0b90555909905559b990555b00005559a0555559900555599a05555 -- 060:555500bb555550bb5555009955550b9955500bb0555099b05550989055508880 -- 061:bb009900bb000055abba05559999055508890555089905555099055550000555 -- 062:5555555555555555555555555555555555555555555555555555555555555555 -- 063:5555555555555555555555555555555555555555555555555555555555555555 -- 064:5555555555555555555555555555555555555555555555555555555555555555 -- 065:5555555555555555555555555555555555555555555555555555555555555555 -- 066:5555555555555555555555555555555555555555555555555555555555555555 -- 067:5555555555555555555555555555555555555555555555555555555555555555 -- 068:5555555555555555555555555555555555555555555555555555555555555555 -- 069:5555555555555555555555555555555555555555555555555555555555555555 -- 070:5555555555555555555555555555555555555555555555555555555555555555 -- 071:5555555555555555555555555555555555555555555555555555555555555555 -- 072:5555555555555555555555555555555555555555555555555555555555555555 -- 073:5555555555555555555555555555555555555555555555555555555555555555 -- 074:5555555555555555555555555555555555555555555555555555555555555555 -- 075:5555555555555555555555555555555555555555555555555555555555555555 -- 076:5555555555555555555555555555555555555555555555555555555555555555 -- 077:5555555555555555555555555555555555555555555555555555555555555555 -- 078:5555555555555555555555555555555555555555555555555555555555555555 -- 079:5555555555555555555555555555555555555555555555555555555555555555 -- 080:5555555555555555555555555555555555555555555555555555555555555555 -- 081:5555555555555555555555555555555555555555555555555555555555555555 -- 082:5555555555555555555555555555555555555555555555555555555555555555 -- 083:5555555555555555555555555555555555555555555555555555555555555555 -- 084:5555555555555555555555555555555555555555555555555555555555555555 -- 085:5555555555555555555555555555555555555555555555555555555555555555 -- 086:5555555555555555555555555555555555555555555555555555555555555555 -- 087:5555555555555555555555555555555555555555555555555555555555555555 -- 088:5555555555555555555555555555555555555555555555555555555555555555 -- 089:5555555555555555555555555555555555555555555555555555555555555555 -- 090:5555555555555555555555555555555555555555555555555555555555555555 -- 091:5555555555555555555555555555555555555555555555555555555555555555 -- 092:5555555555555555555555555555555555555555555555555555555555555555 -- 093:5555555555555555555555555555555555555555555555555555555555555555 -- 094:5555555555555555555555555555555555555555555555555555555555555555 -- 095:5555555555555555555555555555555555555555555555555555555555555555 -- 096:5555555555555555555555555555555555555555555555555555555555555555 -- 097:5555555555555555555555555555555555555555555555555555555555555555 -- 098:5555555555555555555555555555555555555555555555555555555555555555 -- 099:5555555555555555555555555555555555555555555555555555555555555555 -- 100:5555555555555555555555555555555555555555555555555555555555555555 -- 101:5555555555555555555555555555555555555555555555555555555555555555 -- 102:5555555555555555555555555555555555555555555555555555555555555555 -- 103:5555555555555555555555555555555555555555555555555555555555555555 -- 104:5555555555555555555555555555555555555555555555555555555555555555 -- 105:5555555555555555555555555555555555555555555555555555555555555555 -- 106:5555555555555555555555555555555555555555555555555555555555555555 -- 107:5555555555555555555555555555555555555555555555555555555555555555 -- 108:5555555555555555555555555555555555555555555555555555555555555555 -- 109:5555555555555555555555555555555555555555555555555555555555555555 -- 110:5555555555555555555555555555555555555555555555555555555555555555 -- 111:5555555555555555555555555555555555555555555555555555555555555555 -- 112:5555555555555555555555555555555555555555555555555555555555555555 -- 113:5555555555555555555555555555555555555555555555555555555555555555 -- 114:5555555555555555555555555555555555555555555555555555555555555555 -- 115:5555555555555555555555555555555555555555555555555555555555555555 -- 116:5555555555555555555555555555555555555555555555555555555555555555 -- 117:5555555555555555555555555555555555555555555555555555555555555555 -- 118:5555555555555555555555555555555555555555555555555555555555555555 -- 119:5555555555555555555555555555555555555555555555555555555555555555 -- 120:5555555555555555555555555555555555555555555555555555555555555555 -- 121:5555555555555555555555555555555555555555555555555555555555555555 -- 122:5555555555555555555555555555555555555555555555555555555555555555 -- 123:5555555555555555555555555555555555555555555555555555555555555555 -- 124:5555555555555555555555555555555555555555555555555555555555555555 -- 125:5555555555555555555555555555555555555555555555555555555555555555 -- 126:5555555555555555555555555555555555555555555555555555555555555555 -- 127:5555555555555555555555555555555555555555555555555555555555555555 -- 128:5555555555555555555555555555555555555555555555555555555555555555 -- 129:5555555555555555555555555555555555555555555555555555555555555555 -- 130:5555555555555555555555555555555555555555555555555555555555555555 -- 131:5555555555555555555555555555555555555555555555555555555555555555 -- 132:5555555555555555555555555555555555555555555555555555555555555555 -- 133:5555555555555555555555555555555555555555555555555555555555555555 -- 134:5555555555555555555555555555555555555555555555555555555555555555 -- 135:5555555555555555555555555555555555555555555555555555555555555555 -- 136:5555555555555555555555555555555555555555555555555555555555555555 -- 137:5555555555555555555555555555555555555555555555555555555555555555 -- 138:5555555555555555555555555555555555555555555555555555555555555555 -- 139:5555555555555555555555555555555555555555555555555555555555555555 -- 140:5555555555555555555555555555555555555555555555555555555555555555 -- 141:5555555555555555555555555555555555555555555555555555555555555555 -- 142:5555555555555555555555555555555555555555555555555555555555555555 -- 143:5555555555555555555555555555555555555555555555555555555555555555 -- 144:5555555555555555555555555555555555555555555555555555555555555555 -- 145:5555555555555555555555555555555555555555555555555555555555555555 -- 146:5555555555555555555555555555555555555555555555555555555555555555 -- 147:5555555555555555555555555555555555555555555555555555555555555555 -- 148:5555555555555555555555555555555555555555555555555555555555555555 -- 149:5555555555555555555555555555555555555555555555555555555555555555 -- 150:5555555555555555555555555555555555555555555555555555555555555555 -- 151:5555555555555555555555555555555555555555555555555555555555555555 -- 152:5555555555555555555555555555555555555555555555555555555555555555 -- 153:5555555555555555555555555555555555555555555555555555555555555555 -- 154:5555555555555555555555555555555555555555555555555555555555555555 -- 155:5555555555555555555555555555555555555555555555555555555555555555 -- 156:5555555555555555555555555555555555555555555555555555555555555555 -- 157:5555555555555555555555555555555555555555555555555555555555555555 -- 158:5555555555555555555555555555555555555555555555555555555555555555 -- 159:5555555555555555555555555555555555555555555555555555555555555555 -- 160:5555555555555555555555555555555555555555555555555555555555555555 -- 161:5555555555555555555555555555555555555555555555555555555555555555 -- 162:5555555555555555555555555555555555555555555555555555555555555555 -- 163:5555555555555555555555555555555555555555555555555555555555555555 -- 164:5555555555555555555555555555555555555555555555555555555555555555 -- 165:5555555555555555555555555555555555555555555555555555555555555555 -- 166:5555555555555555555555555555555555555555555555555555555555555555 -- 167:5555555555555555555555555555555555555555555555555555555555555555 -- 168:5555555555555555555555555555555555555555555555555555555555555555 -- 169:5555555555555555555555555555555555555555555555555555555555555555 -- 170:5555555555555555555555555555555555555555555555555555555555555555 -- 171:5555555555555555555555555555555555555555555555555555555555555555 -- 172:5555555555555555555555555555555555555555555555555555555555555555 -- 173:5555555555555555555555555555555555555555555555555555555555555555 -- 174:5555555555555555555555555555555555555555555555555555555555555555 -- 175:5555555555555555555555555555555555555555555555555555555555555555 -- 176:5555555555555555555555555555555555555555555555555555555555555555 -- 177:5555555555555555555555555555555555555555555555555555555555555555 -- 178:5555555555555555555555555555555555555555555555555555555555555555 -- 179:5555555555555555555555555555555555555555555555555555555555555555 -- 180:5555555555555555555555555555555555555555555555555555555555555555 -- 181:5555555555555555555555555555555555555555555555555555555555555555 -- 182:5555555555555555555555555555555555555555555555555555555555555555 -- 183:5555555555555555555555555555555555555555555555555555555555555555 -- 184:5555555555555555555555555555555555555555555555555555555555555555 -- 185:5555555555555555555555555555555555555555555555555555555555555555 -- 186:5555555555555555555555555555555555555555555555555555555555555555 -- 187:5555555555555555555555555555555555555555555555555555555555555555 -- 188:5555555555555555555555555555555555555555555555555555555555555555 -- 189:5555555555555555555555555555555555555555555555555555555555555555 -- 190:5555555555555555555555555555555555555555555555555555555555555555 -- 191:5555555555555555555555555555555555555555555555555555555555555555 -- 192:5555555555555555555555555555555555555555555555555555555555555555 -- 193:5555555555555555555555555555555555555555555555555555555555555555 -- 194:5555555555555555555555555555555555555555555555555555555555555555 -- 195:5555555555555555555555555555555555555555555555555555555555555555 -- 196:5555555555555555555555555555555555555555555555555555555555555555 -- 197:5555555555555555555555555555555555555555555555555555555555555555 -- 198:5555555555555555555555555555555555555555555555555555555555555555 -- 199:5555555555555555555555555555555555555555555555555555555555555555 -- 200:5555555555555555555555555555555555555555555555555555555555555555 -- 201:5555555555555555555555555555555555555555555555555555555555555555 -- 202:5555555555555555555555555555555555555555555555555555555555555555 -- 203:5555555555555555555555555555555555555555555555555555555555555555 -- 204:5555555555555555555555555555555555555555555555555555555555555555 -- 205:5555555555555555555555555555555555555555555555555555555555555555 -- 206:5555555555555555555555555555555555555555555555555555555555555555 -- 207:5555555555555555555555555555555555555555555555555555555555555555 -- 208:5555555555555555555555555555555555555555555555555555555555555555 -- 209:5555555555555555555555555555555555555555555555555555555555555555 -- 210:5555555555555555555555555555555555555555555555555555555555555555 -- 211:5555555555555555555555555555555555555555555555555555555555555555 -- 212:5555555555555555555555555555555555555555555555555555555555555555 -- 213:5555555555555555555555555555555555555555555555555555555555555555 -- 214:5555555555555555555555555555555555555555555555555555555555555555 -- 215:5555555555555555555555555555555555555555555555555555555555555555 -- 216:5555555555555555555555555555555555555555555555555555555555555555 -- 217:5555555555555555555555555555555555555555555555555555555555555555 -- 218:5555555555555555555555555555555555555555555555555555555555555555 -- 219:5555555555555555555555555555555555555555555555555555555555555555 -- 220:5555555555555555555555555555555555555555555555555555555555555555 -- 221:5555555555555555555555555555555555555555555555555555555555555555 -- 222:5555555555555555555555555555555555555555555555555555555555555555 -- 223:5555555555555555555555555555555555555555555555555555555555555555 -- 224:5555555555555555555555555555555555555555555555555555555555555555 -- 225:5555555555555555555555555555555555555555555555555555555555555555 -- 226:5555555555555555555555555555555555555555555555555555555555555555 -- 227:5555555555555555555555555555555555555555555555555555555555555555 -- 228:5555555555555555555555555555555555555555555555555555555555555555 -- 229:5555555555555555555555555555555555555555555555555555555555555555 -- 230:5555555555555555555555555555555555555555555555555555555555555555 -- 231:5555555555555555555555555555555555555555555555555555555555555555 -- 232:5555555555555555555555555555555555555555555555555555555555555555 -- 233:5555555555555555555555555555555555555555555555555555555555555555 -- 234:5555555555555555555555555555555555555555555555555555555555555555 -- 235:5555555555555555555555555555555555555555555555555555555555555555 -- 236:5555555555555555555555555555555555555555555555555555555555555555 -- 237:5555555555555555555555555555555555555555555555555555555555555555 -- 238:5555555555555555555555555555555555555555555555555555555555555555 -- 239:5555555555555555555555555555555555555555555555555555555555555555 -- 240:5555555555555555555555555555555555555555555555555555555555555555 -- 241:5555555555555555555555555555555555555555555555555555555555555555 -- 242:5555555555555555555555555555555555555555555555555555555555555555 -- 243:5555555555555555555555555555555555555555555555555555555555555555 -- 244:5555555555555555555555555555555555555555555555555555555555555555 -- 245:5555555555555555555555555555555555555555555555555555555555555555 -- 246:5555555555555555555555555555555555555555555555555555555555555555 -- 247:5555555555555555555555555555555555555555555555555555555555555555 -- 248:5555555555555555555555555555555555555555555555555555555555555555 -- 249:5555555555555555555555555555555555555555555555555555555555555555 -- 250:5555555555555555555555555555555555555555555555555555555555555555 -- 251:5555555555555555555555555555555555555555555555555555555555555555 -- 252:5555555555555555555555555555555555555555555555555555555555555555 -- 253:5555555555555555555555555555555555555555555555555555555555555555 -- 254:5555555555555555555555555555555555555555555555555555555555555555 -- 255:5555555555555555555555555555555555555555555555555555555555555555 -- -- -- 000:00000000ffffffff00000000ffffffff -- 001:0123456789abcdeffedcba9876543210 -- 002:0123456789abcdef0123456789abcdef -- -- -- 000:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000304000000000 -- -- -- 000:100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -- -- -- 000:1a1c2c5d275db13e53ef7d57ffcd75a7f07038b76425717929366f3b5dc941a6f673eff7f4f4f494b0c2566c86333c57 --