エラーが発生しています。

BE GOD

by mj, at 2015年7月 2日 16:22:53

powered by hsp3dish.js / OpenHSP

コメント
説明

あなたは神です。
迷える子羊(緑色の●)を導き、できるだけ長生きさせてあげてください。

操作

左クリック: 溶岩を落とす

ルール

  • 迷える子羊(緑の●)は右に進み続けます
  • ほうっておくと彼は、溶岩に当たる、取り残される、水に溺れるのいづれかで死んでしまいます
  • あなたは水に溶岩を落とし、岩を作って彼の進む道を作らなければいけません
  • 水と溶岩が触れると、岩と水蒸気が発生します
  • 水蒸気が溜まると、雨となって落ちてきます。気を付けてください

去年の作品です
http://dev.onionsoft.net/seed/info.ax?id=752

更新履歴

2015/8/23: 左上をクリックするとエラーが出る不具合を修正。

#include "hsp3dish.as"

title "BE GOD"

#enum OBJ_STATE = 0
#enum OBJ_X
#enum OBJ_Y
#enum OBJ_UPDATED

#enum STATE_STEAM = 0
#enum STATE_AIR
#enum STATE_WATER
#enum STATE_ME
#enum STATE_LAVA
#enum STATE_ROCK

#enum STAGE_NOP = 0
#enum STAGE_TITLE
#enum STAGE_INIT
#enum STAGE_PLAYING
#enum STAGE_FINISH

#define SCREEN_W ginfo_sx
#define SCREEN_H ginfo_sy

#const MASS_W 20
#const MASS_H 20

#define MASS_H_NUM SCREEN_W/MASS_W
#define MASS_V_NUM SCREEN_H/MASS_H

#define MASS_H_NUM_DIV_2 MASS_H_NUM/2
#define MASS_V_NUM_DIV_2 MASS_V_NUM/2
#define MASS_H_NUM_DIV_4 MASS_H_NUM/4
#define MASS_V_NUM_DIV_4 MASS_V_NUM/4
#define MASS_H_NUM_PLUS_2 MASS_H_NUM+2
#define MASS_V_NUM_PLUS_2 MASS_V_NUM+2
#define MASS_H_NUM_PLUS_1 MASS_H_NUM+1
#define MASS_V_NUM_PLUS_1 MASS_V_NUM+1
#define MASS_H_NUM_MINUS_1 MASS_H_NUM-1
#define MASS_V_NUM_MINUS_1 MASS_V_NUM-1
#define MASS_H_NUM_DIV_2_MINUS_1 MASS_H_NUM/2-1
#define MASS_V_NUM_DIV_2_MINUS_1 MASS_V_NUM/2-1
#define MASS_H_NUM_DIV_2_PLUS_1 MASS_H_NUM/2+1
#define MASS_V_NUM_DIV_2_PLUS_1 MASS_V_NUM/2+1

#const SCROLL_INTERVAL 5

#const HP_MAX 1000

#const PI 3.1415926535

Font_size = 18
Font_size_w = 18
Font_size_h = 18

Score_cap_width = 105
Score_cap_x = Font_size /2
Score_cap_y = Font_size /2

Score_cap_bottom_x = SCREEN_W/2
Score_cap_bottom_y = SCREEN_H/2

Ready_cap_width = 239
Ready_cap_x = Font_size
Ready_cap_y = SCREEN_H /4

Go_cap_width = 192
Go_cap_x = Ready_cap_x
Go_cap_y = Ready_cap_y

Tryagain_cap_width = 248
Tryagain_cap_x = SCREEN_W/2 - Tryagain_cap_width / 2
Tryagain_cap_y = SCREEN_H - 70

Title_cap_width = 358
Title_cap_x = SCREEN_W /2 - Title_cap_width /2
Title_cap_y = 100

Push_cap_width = 249
Push_cap_x = Tryagain_cap_x
Push_cap_y = Tryagain_cap_y

Highscore_cap_width = 172
Highscore_cap_x = SCREEN_W /2 - Highscore_cap_width /2 - 60
Highscore_cap_y = Title_cap_y + 80

Dead_reason_width = 392
Dead_reason_x = Ready_cap_x
Dead_reason_y = Ready_cap_y

dim Objs, MASS_H_NUM_PLUS_2, MASS_V_NUM_PLUS_2, 4

Stage = STAGE_TITLE
Highscore = 0

exist "/save/highscore"
if (strsize > 0) {
	bload "/save/highscore", Highscore
}

celload "blocks.png"
Blocks_id = stat
celdiv stat, 10, 10, 0, 0

buffer Blocks_id + 1
gsel Blocks_id + 1
picload "chars.png", 0
Chars_id = Blocks_id + 1

celload "sheep.png"
Sheep_id = stat
celdiv stat, 30, 30

buffer Sheep_id + 1
gsel Sheep_id + 1
picload "ui.png", 0
UI_id = Sheep_id + 1

gsel 0

gmode 2

*init

bsave "/save/highscore", Highscore

devcontrol "syncfs"
	
me_x = 1000
me_y = 1000
Stage_frame = 0
HP = HP_MAX
Dead_reason = ""

repeat MASS_H_NUM_PLUS_2
	x = cnt
	repeat MASS_V_NUM_PLUS_2
		state = STATE_AIR
		if (x == 0 || x == MASS_H_NUM_PLUS_1 || cnt == 0 || cnt == MASS_V_NUM_PLUS_1) {
			state = STATE_ROCK
		}
		Objs(x, cnt, OBJ_STATE) = state
	loop
loop

*main
	
	if (Stage != STAGE_PLAYING) {
		stick keys, 0
	} else {
		stick keys, 256
	}

	if (Stage != STAGE_FINISH) { Stage_frame++ } else { goto *scene }
	
	repeat MASS_H_NUM, 1
		x = cnt
	
		repeat MASS_V_NUM, 1
			y = cnt
	
			if (Objs(x, y, OBJ_UPDATED)) { continue }
	
			x_m_1 = x-1
			x_p_1 = x+1
			y_m_1 = y-1
			y_p_1 = y+1
	
			state    = Objs(x, y, OBJ_STATE)
			rd_state = Objs(x_p_1, y_p_1, OBJ_STATE)
			ld_state = Objs(x_m_1, y_p_1, OBJ_STATE)
			d_state  = Objs(x, y_p_1, OBJ_STATE)
			r_state  = Objs(x_p_1, y, OBJ_STATE)
			rt_state = Objs(x_p_1, y_m_1, OBJ_STATE)
	
			// 基準点の近傍
			steam_cnt = 0
			repeat 3, x-1
				tmp_x = cnt
				repeat 3, y-1
					tmp_y = cnt

					tmp_state = Objs(tmp_x, tmp_y, OBJ_STATE)
					if (tmp_state == STATE_STEAM) {
						steam_cnt++
					}
	
					// 溶岩から岩へ
					if (tmp_state==STATE_WATER && state==STATE_LAVA) {
						Objs(x, y, OBJ_STATE) = STATE_ROCK
						Objs(tmp_x, tmp_y, OBJ_STATE) = STATE_STEAM
					}
					// 自機
					if (Stage == STAGE_PLAYING) {
						if (tmp_state == STATE_LAVA && (me_x == x && me_y == y)) {

							HP -= 5
							if (HP <= 0) {
								Dead_reason = "BURNED!!"
								Stage = STAGE_FINISH
							}
						}
					}
				loop
			loop
	
			if (Stage == STAGE_PLAYING) {
				if ((Objs(x_m_1, y_m_1, OBJ_STATE) & Objs(x, y_m_1, OBJ_STATE) & rt_state) == STATE_WATER) {
					if (me_x == x && me_y == y) {
		
						HP -= 2
						if (HP <= 0) {
							Dead_reason = "DROWNED!!"
							Stage = STAGE_FINISH
						}
					}
				}
			}
	
			// 蒸気から水へ
			if (steam_cnt > 4) {
				repeat 3, x-1
					tmp_x = cnt
					repeat 3, y-1
						tmp_y = cnt
						if (Objs(tmp_x, tmp_y, OBJ_STATE) == STATE_STEAM) {
							Objs(tmp_x, tmp_y, OBJ_STATE) = STATE_AIR
						}
					loop
				loop
				Objs(x, y, OBJ_STATE) = STATE_WATER
			}
	
			// □□□
			// □ □
			// □■□
			if (state > d_state) {
				if (Objs(x, y_p_1, OBJ_UPDATED)) { continue }
	
				Objs(x, y, OBJ_STATE)     = d_state
				Objs(x, y_p_1, OBJ_STATE)   = state
				Objs(x, y, OBJ_UPDATED)   = 1
				Objs(x, y_p_1, OBJ_UPDATED) = 1
	
			} else {
				
				if (me_x == x && me_y == y) { continue }
				
				if (rnd(2)) {
					// □□□
					// □ □
					// ■□□
					if (state > ld_state) {
						if (Objs(x_m_1, y_p_1, OBJ_UPDATED)) { continue }
	
						Objs(x, y, OBJ_STATE)       = ld_state
						Objs(x_m_1, y_p_1, OBJ_STATE)   = state
						//Objs(x, y, OBJ_UPDATED)     = 1
						Objs(x_m_1, y_p_1, OBJ_UPDATED) = 1
					}
				} else {
	
					// □□□
					// □ □
					// □□■
					if (state > rd_state) {
						if (Objs(x_p_1, y_p_1, OBJ_UPDATED)) { continue }
	
						Objs(x, y, OBJ_STATE)   = rd_state
						Objs(x_p_1, y_p_1, OBJ_STATE)   = state
						//Objs(x, y, OBJ_UPDATED)   = 1
						Objs(x_p_1, y_p_1, OBJ_UPDATED) = 1
					} else {
	
						if (state==STATE_WATER || state==STATE_LAVA) {
							if (state > r_state) {
								// □□□
								// □ ■
								// □□□
								if (Objs(x_p_1, y, OBJ_UPDATED)) { continue }
		
								Objs(x, y, OBJ_STATE)     = r_state
								Objs(x_p_1, y, OBJ_STATE)   = state
								//Objs(x, y, OBJ_UPDATED)   = 1
								Objs(x_p_1, y, OBJ_UPDATED) = 1
								
							} else {
							// □□□
							// ■ □
							// □□□
								if (Objs(x_m_1, y, OBJ_UPDATED)) { continue }
		
								Objs(x, y, OBJ_STATE)     = Objs(x_m_1, y, OBJ_STATE)
								Objs(x_m_1, y, OBJ_STATE)   = state
								//Objs(x, y, OBJ_UPDATED)   = 1
								Objs(x_m_1, y, OBJ_UPDATED) = 1
							}
						}
					}
				}
			}
			
			
		loop
	loop
	
	if (Stage != STAGE_FINISH) {
		redraw 0
		color 127,191,255:boxf
	}

	repeat MASS_H_NUM, 1
		x = cnt
		repeat MASS_V_NUM, 1
			Objs(x, cnt, OBJ_UPDATED) = 0
	
			state = Objs(x, cnt, OBJ_STATE)
	
			pos (x-1)*MASS_W, (cnt-1)*MASS_H
			if (state != STATE_AIR) {
				celput Blocks_id, state, MASS_W/10.0, MASS_H/10.0
			}
		loop
	loop
	
	pos (me_x-1)*MASS_W-10, (me_y-1)*MASS_H-10
	celput Sheep_id, ((Stage_frame\30) < 15), MASS_W/10.0, MASS_H/10.0
	
*scene
	
	if (Stage == STAGE_TITLE) {
		if (keys & 256) { 
	
			//if ((mousex > Push_cap_x) && (mousex < Push_cap_x+Push_cap_width) && (mousey > Push_cap_y) && (mousey < Push_cap_y+18)) {
				Stage = STAGE_INIT
	
				goto *init
			//}
		}
		
		pos Title_cap_x, Title_cap_y
		gcopy Chars_id, 1, 38, 358, 58
		
		//if ((mousex > Push_cap_x) && (mousex < Push_cap_x+Push_cap_width) && (mousey > Push_cap_y) && (mousey < Push_cap_y+18)) {
		//	pos Push_cap_x + 5, Push_cap_y + 5
		//} else {
			pos Push_cap_x, Push_cap_y
		//}
		gcopy Chars_id, 3, 99, 249, 21
	
		pos Highscore_cap_x, Highscore_cap_y
		gcopy Chars_id, 0, 20, 172, 15
	
		pos Highscore_cap_x + 172, Highscore_cap_y
		tmp_score = Highscore
		repeat
			if (tmp_score == 0) { break }
	
			pos Highscore_cap_x + 252 - cnt*18, Highscore_cap_y -2
			gcopy Chars_id, 18*(tmp_score \ 10), 0, 18, 18
	
			tmp_score /= 10
		loop
	
		state = rnd(5)
		if (state == STATE_ME) { state = 0 }
		x = int(sin((double(Stage_frame\360)/180.0)*PI)*(MASS_H_NUM_DIV_2_MINUS_1))+MASS_H_NUM_DIV_2_PLUS_1
		repeat 9
			Objs(x+cnt\3-1, MASS_V_NUM_DIV_2+cnt/3-1, OBJ_STATE) = state
		loop
	}
	
	if (Stage == STAGE_INIT) {
		if (Stage_frame < 10) {
			repeat MASS_H_NUM, 1
				Objs(cnt, 1, OBJ_STATE) = STATE_ROCK
			loop
		} else : if (Stage_frame < 80) {
			repeat 3, -1
				Objs(MASS_H_NUM_DIV_2+cnt, MASS_V_NUM_DIV_4, OBJ_STATE) = STATE_ROCK
			loop
		} else : if (Stage_frame < 90) {
			repeat MASS_H_NUM_DIV_4, 1
				Objs(cnt, 1, OBJ_STATE) = STATE_LAVA
				Objs(MASS_H_NUM-cnt, 1, OBJ_STATE) = STATE_WATER
			loop
		} else : if (Stage_frame == 90) {
			me_x = MASS_H_NUM_DIV_2
			repeat MASS_V_NUM -1, 1
				if (Objs(MASS_H_NUM_DIV_2, cnt, OBJ_STATE) == STATE_ROCK) {
					me_y = cnt-1
					break
				}
			loop
		}
		
		if (Stage_frame < 100) {	
			pos Ready_cap_x, Ready_cap_y
			gcopy Chars_id, 2, 121, 239, 40
		} else : if (Stage_frame < 115) {
			pos Go_cap_x, Go_cap_y
			gcopy Chars_id, 242, 121, 192, 40
		} else {
			Stage = STAGE_PLAYING
			Stage_frame = 0
		}
	}
	
	if (Stage == STAGE_PLAYING) {
		if (keys & 256) {
			repeat 3, -1
				Objs(limit(mousex/MASS_W+cnt, 0, MASS_H_NUM), limit(mousey/MASS_H, 0, MASS_V_NUM), OBJ_STATE) = STATE_LAVA
			loop
		}
	
		pos Score_cap_x, Score_cap_y
		gcopy Chars_id, 173, 20, 105, 14
	
		tmp_score = Stage_frame
		repeat
			if (tmp_score == 0) { break }
	
			pos Score_cap_x + 165 - cnt*18, Score_cap_y -2
			gcopy Chars_id, 18*(tmp_score \ 10), 0, 18, 18
	
			tmp_score /= 10
		loop
	
		tmp_hp = HP_MAX / 100
		repeat 100
			pos Score_cap_x +2*cnt, Score_cap_y +20
	
			if (tmp_hp*cnt > HP) { // 空
				if (cnt == 0) {
					gcopy UI_id, 0, 0, 2, 18
				} else : if (cnt == 99) {
					gcopy UI_id, 10, 0, 2, 18
				} else {
					gcopy UI_id, 4, 0, 2, 18
				}
			} else { // 満
				if (cnt == 0) {
					gcopy UI_id, 2, 0, 2, 18
				} else : if (cnt == 99) {
					gcopy UI_id, 8, 0, 2, 18
				} else {
					gcopy UI_id, 6, 0, 2, 18
				} 
			}
		loop
	}
	
	if (Stage == STAGE_FINISH) {
		if (keys & 256) {
			//if ((mousex > Push_cap_x) && (mousex < Push_cap_x+Push_cap_width) && (mousey > Push_cap_y) && (mousey < Push_cap_y+18)) {
				if (Stage_frame > Highscore) { Highscore = Stage_frame }
				Stage = STAGE_TITLE
				goto *init
			//}
		}
		
		pos Dead_reason_x, Dead_reason_y
		if (Dead_reason == "DROWNED!!") {
			gcopy Chars_id, 0, 160, 392, 39
		} else : if (Dead_reason == "BURNED!!") {
			gcopy Chars_id, 0, 200, 352, 39
		} else : if (Dead_reason == "LEFT!!")  {
			gcopy Chars_id, 0, 240, 272, 39
		}
	
		pos Score_cap_bottom_x, Score_cap_bottom_y
		gcopy Chars_id, 173, 20, 105, 14

		tmp_score = Stage_frame
		repeat
			if (tmp_score == 0) { break }
	
			pos Score_cap_bottom_x + 165 - cnt*18, Score_cap_bottom_y -2
			gcopy Chars_id, 18*(tmp_score \ 10), 0, 18, 18
	
			tmp_score /= 10
		loop
		
		pos Tryagain_cap_x, Tryagain_cap_y
		gcopy Chars_id, 255, 97, 248, 23
	}
	
	redraw 1
	
	if (Stage == STAGE_PLAYING) {
	    // スクロール処理
		if (Stage_frame\SCROLL_INTERVAL == 0) {
	
			// 右へ
			repeat MASS_H_NUM_MINUS_1, 1
				x = cnt
				repeat MASS_V_NUM, 1
					Objs(x, cnt, OBJ_STATE) = Objs(x+1, cnt, OBJ_STATE)
				loop
			loop
	
			repeat MASS_V_NUM -1, 1
				if (Objs(MASS_H_NUM_DIV_2, cnt, OBJ_STATE) == STATE_ROCK) {
					me_y = cnt-1
					break
				}
			loop
	
			if (me_y < MASS_V_NUM_DIV_2) {
				
				repeat MASS_V_NUM_MINUS_1, 1
					y = MASS_V_NUM_MINUS_1 - cnt + 1
					if (y == 1) {
						repeat MASS_H_NUM
							Objs(cnt, y, OBJ_STATE) = STATE_AIR
						loop
					} else {
						repeat MASS_H_NUM
							Objs(cnt, y, OBJ_STATE) = Objs(cnt, y-1, OBJ_STATE)
						loop
					}
				loop
	
				me_y += 1
				
			} else : if (me_y > MASS_V_NUM_DIV_2) {
				
				repeat MASS_V_NUM_MINUS_1, 1
					y = cnt
					if (y == MASS_V_NUM_MINUS_1-1) {
						repeat MASS_H_NUM
							Objs(cnt, y, OBJ_STATE) = STATE_ROCK
						loop
					} else {
						repeat MASS_H_NUM
							if (Objs(cnt, y, OBJ_STATE) == STATE_STEAM) { continue }
							Objs(cnt, y, OBJ_STATE) = Objs(cnt, y+1, OBJ_STATE)
						loop
					}
				loop
	
				me_y -= 1
				
			}
	
			if (rnd(5) == 0) {
				tmp_state = STATE_STEAM
			} else {
				tmp_state = STATE_WATER
			}
			repeat rnd(10)
				x = cnt\3 -1
				y = cnt/3 -1
				Objs(MASS_H_NUM+x-1, 3+y, OBJ_STATE) = tmp_state
			loop
		}
	}

	await 60
	
goto *main

作成者
icon

mj

ここはユーザの紹介文

詳しく...


関連プログラム