listing1.cpp

来自「C人工智能游戏开发的一些实例源代码 C Game development in 」· C++ 代码 · 共 36 行

CPP
36
字号
/* Copyright (C) Jonty Barnes and Jason Hutchens, 2001. 
 * All rights reserved worldwide.
 *
 * This software is provided "as is" without express or implied
 * warranties. You may freely copy and compile this source into
 * applications you distribute provided that the copyright text
 * below is included in the resulting source code, for example:
 * "Portions Copyright (C) Jonty Barnes and Jason Hutchens, 2001"
 */

// A simple script written in the Challenge programming language.

begin script SickCow(Target)
	Cow = create ANIMAL COW at position of hand
Start
	make evil spirit point to Cow
	say "This unhealthy beast is on its last legs!"
	move Cow to {Target}
	begin loop
		wait 3 seconds
		HEALTH of Cow -= 0.1
		if {Cow} near {Target} radius 15
			say "It's almost there! Hurry up and die, bovine!"
		elsif HEALTH of Cow < 0.5 and HEALTH of Cow > 0.3
			say "It's almost dead! Yippee!"
		elsif Cow is FLYING
			say "Is it a bird? Is it a plane? No. It's a cow."
		end if
	until {Cow} at {Target}
		say "It made it to safety. How unfortunate!"
	until HEALTH of Cow <= 0
		say "Ha! It's steak for dinner!"
	end loop
	send evil spirit home
end script SickCow

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?