gameobjs.py 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860
  1. # Flexlay - A Generic 2D Game Editor
  2. # Copyright (C) 2014 Ingo Ruhnke <grumbel@gmail.com>
  3. #
  4. # This program is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation, either version 3 of the License, or
  7. # (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. from typing import Any
  17. import logging
  18. from enum import IntEnum
  19. from PyQt5.QtWidgets import QWidget
  20. from flexlay.objmap_path_node import ObjMapPathNode
  21. from flexlay.util.sexpr_writer import SExprWriter
  22. from flexlay.color import Colorf
  23. from flexlay.objmap_object import ObjMapObject
  24. from flexlay.math import Pointf
  25. from flexlay.property import (
  26. BoolProperty,
  27. ColorProperty,
  28. EnumProperty,
  29. FloatProperty,
  30. IntProperty,
  31. StringProperty,
  32. )
  33. from supertux.property import (
  34. BadGuyProperty,
  35. DirectionProperty,
  36. ImageProperty,
  37. InlinePosProperty,
  38. InlineRectProperty,
  39. PathProperty,
  40. SampleProperty,
  41. SectorProperty,
  42. SpriteProperty,
  43. TilemapProperty,
  44. ZPosProperty,
  45. )
  46. from supertux.gameobj import GameObj, make_sprite_object, make_rect_object
  47. from supertux.constraint import GridConstraint
  48. class Layer(IntEnum):
  49. BACKGROUND0 = -300
  50. BACKGROUND1 = -200
  51. BACKGROUNDTILES = -100
  52. TILES = 0
  53. OBJECTS = 50
  54. FLOATINGOBJECTS = 150
  55. FOREGROUNDTILES = 200
  56. FOREGROUND0 = 300
  57. FOREGROUND1 = 400
  58. LIGHTMAP = 450
  59. HUD = 500,
  60. GUI = 600
  61. class Tux(GameObj):
  62. """Unfinished:
  63. To be dragged to where you want tux to spawn when you run the level, but *is not*
  64. the spawnpoint.
  65. """
  66. label = "Tux"
  67. identifier = "tux"
  68. sprite = "images/creatures/tux/big/jump-0.png"
  69. def __init__(self) -> None:
  70. super().__init__()
  71. self.objmap_object = make_sprite_object(self, self.sprite)
  72. self.signal_connect()
  73. def read(self, sexpr: Any) -> None:
  74. pass
  75. def write(self, writer: SExprWriter, obj: Any) -> None:
  76. pass
  77. class LevelTime(GameObj):
  78. label = "LevelTime"
  79. identifier = "leveltime"
  80. sprite = "images/engine/editor/clock.png"
  81. def __init__(self) -> None:
  82. super().__init__()
  83. self.objmap_object = make_sprite_object(self, self.sprite)
  84. self.signal_connect()
  85. self.properties = [
  86. IntProperty("Time", "time", optional=True)
  87. ]
  88. class Camera(GameObj):
  89. label = "Camera"
  90. identifier = "camera"
  91. sprite = "images/engine/editor/camera.png"
  92. values = ["normal", "autoscroll"]
  93. def __init__(self) -> None:
  94. super().__init__()
  95. self.objmap_object = ObjMapObject(Pointf(0, 0), self)
  96. self.objmap_object.to_draw = False
  97. self.signal_connect()
  98. self.properties = [
  99. EnumProperty("Mode", "mode", default=0, optional=False, values=self.values),
  100. BoolProperty("Backscrollling", "backscrolling", optional=True, default=True),
  101. PathProperty("Path", "path")
  102. ]
  103. class ResetPoint(GameObj):
  104. label = "ResetPoint"
  105. identifier = "firefly"
  106. sprite = "images/objects/resetpoints/default-resetpoint.sprite"
  107. # ["bell", "images/objects/bell/bell.sprite", "sprite",
  108. # lambda data, sexpr: SimpleObject("bell")],
  109. def __init__(self) -> None:
  110. super().__init__()
  111. self.objmap_object = make_sprite_object(self, self.sprite)
  112. self.signal_connect()
  113. self.properties = [
  114. SpriteProperty("Sprite", "sprite"),
  115. InlinePosProperty()
  116. ]
  117. class GhostFlame(GameObj):
  118. label = "GhostFlame"
  119. identifier = "ghostflame"
  120. sprite = "images/creatures/flame/ghostflame.sprite"
  121. def __init__(self) -> None:
  122. super().__init__()
  123. self.objmap_object = make_sprite_object(self, self.sprite)
  124. self.signal_connect()
  125. self.properties = [
  126. FloatProperty("Radius", "radius", default=100.0, optional=True),
  127. FloatProperty("Speed", "speed", default=2.0, optional=True),
  128. InlinePosProperty(),
  129. ]
  130. class Flame(GameObj):
  131. label = "Flame"
  132. identifier = "flame"
  133. sprite = "images/creatures/flame/flame.sprite"
  134. def __init__(self) -> None:
  135. super().__init__()
  136. self.objmap_object = make_sprite_object(self, self.sprite)
  137. self.signal_connect()
  138. self.properties = [
  139. FloatProperty("Radius", "radius", default=100.0, optional=True),
  140. FloatProperty("Speed", "speed", default=2.0, optional=True),
  141. InlinePosProperty(),
  142. ]
  143. class Decal(GameObj):
  144. label = "Decal"
  145. identifier = "decal"
  146. sprite = "images/engine/editor/decal.png"
  147. def __init__(self) -> None:
  148. super().__init__()
  149. self.objmap_object = make_sprite_object(self, self.sprite)
  150. self.signal_connect()
  151. self.properties = [
  152. ZPosProperty(),
  153. SpriteProperty("Sprite", "sprite"),
  154. InlinePosProperty(),
  155. ]
  156. def update(self) -> None:
  157. prop = self.find_property("sprite")
  158. assert prop is not None
  159. self.sprite = prop.value
  160. assert self.objmap_object is not None
  161. self.objmap_object = make_sprite_object(self, self.sprite,
  162. Pointf(self.objmap_object.pos.x, self.objmap_object.pos.y))
  163. class Trampoline(GameObj):
  164. label = "Trampoline"
  165. identifier = "trampoline"
  166. sprite = "images/objects/trampoline/trampoline.sprite"
  167. def __init__(self) -> None:
  168. super().__init__()
  169. self.objmap_object = make_sprite_object(self, self.sprite)
  170. self.signal_connect()
  171. self.properties = [
  172. BoolProperty("Portable", "portable", optional=True, default=True),
  173. InlinePosProperty()
  174. ]
  175. class Coin(GameObj):
  176. label = "Coin"
  177. identifier = "coin"
  178. sprite = "images/objects/coin/coin.sprite"
  179. def __init__(self) -> None:
  180. super().__init__()
  181. self.objmap_object = make_sprite_object(self, self.sprite)
  182. self.signal_connect()
  183. self.properties = [
  184. PathProperty("Path", "path")
  185. ]
  186. class Climbable(GameObj):
  187. label = "Climbable"
  188. identifier = "climbable"
  189. sprite = "images/engine/editor/climbable.png"
  190. def __init__(self) -> None:
  191. super().__init__()
  192. self.objmap_object = make_rect_object(self, Colorf(1.0, 1.0, 0))
  193. self.signal_connect()
  194. self.properties = [
  195. InlineRectProperty(),
  196. ]
  197. class SecretArea(GameObj):
  198. label = "SecretArea"
  199. identifier = "secretarea"
  200. sprite = "images/engine/editor/secretarea.png"
  201. def __init__(self) -> None:
  202. super().__init__()
  203. self.objmap_object = make_rect_object(self, Colorf(0, 1.0, 0))
  204. self.signal_connect()
  205. self.properties = [
  206. TilemapProperty("FadeTilemap", "fade-tilemap", optional=True, placeholder="No tilemap"),
  207. StringProperty("Script", "script", "", optional=True, placeholder="Empty script"),
  208. StringProperty("Message", "message", "", optional=True, translatable=False, placeholder="Empty message"),
  209. InlineRectProperty(),
  210. ]
  211. class InvisibleWall(GameObj):
  212. label = "InvisibleWall"
  213. identifier = "invisible_wall"
  214. sprite = "images/engine/editor/invisible_wall.png"
  215. def __init__(self) -> None:
  216. super().__init__()
  217. self.objmap_object = make_rect_object(self, Colorf(0, 0, 0, 0.8))
  218. self.signal_connect()
  219. self.properties = [
  220. InlineRectProperty(),
  221. ]
  222. class AmbientSound(GameObj):
  223. label = "AmbientSound"
  224. identifier = "ambient_sound"
  225. sprite = "images/engine/editor/ambientsound.png"
  226. def __init__(self) -> None:
  227. super().__init__()
  228. self.objmap_object = make_rect_object(self, Colorf(1.0, 0, 0))
  229. self.signal_connect()
  230. self.properties = [
  231. FloatProperty("Distance Factor", "distance_factor", 0.1),
  232. FloatProperty("Distance Bias", "distance_bias", 200),
  233. SampleProperty("Sample", "sample", ""),
  234. IntProperty("Max Volume", "volume", 1),
  235. InlineRectProperty()
  236. ]
  237. class ScriptTrigger(GameObj):
  238. label = "ScriptTrigger"
  239. identifier = "scripttrigger"
  240. sprite = "images/engine/editor/scripttrigger.png"
  241. def __init__(self) -> None:
  242. super().__init__()
  243. self.objmap_object = make_rect_object(self, Colorf(1.0, 0, 1.0))
  244. self.signal_connect()
  245. self.properties = [
  246. StringProperty("Script", "script", ""),
  247. BoolProperty("Button", "button", False),
  248. InlineRectProperty(),
  249. ]
  250. class SequenceTrigger(GameObj):
  251. label = "SequenceTrigger"
  252. identifier = "sequencetrigger"
  253. sprite = "images/engine/editor/sequencetrigger.png"
  254. def __init__(self) -> None:
  255. super().__init__()
  256. self.objmap_object = make_rect_object(self, Colorf(1.0, 0, 0))
  257. self.signal_connect()
  258. self.properties = [
  259. StringProperty("Sequence", "sequence", ""),
  260. InlineRectProperty(),
  261. ]
  262. class BadGuy(GameObj):
  263. def __init__(self, kind: str, sprite_filename: str) -> None:
  264. super().__init__()
  265. self.label = kind
  266. self.identifier = kind
  267. self.sprite = sprite_filename
  268. self.objmap_object = make_sprite_object(self, self.sprite)
  269. self.signal_connect()
  270. self.properties = [
  271. StringProperty("Dead Script", "dead-script", default="", optional=True),
  272. DirectionProperty("Direction", "direction", 0),
  273. SpriteProperty("Sprite", "sprite", default="", optional=True),
  274. InlinePosProperty(),
  275. ]
  276. class Candle(GameObj):
  277. label = "Candle"
  278. identifier = "candle"
  279. sprite = "images/objects/candle/candle.sprite"
  280. def __init__(self) -> None:
  281. super().__init__()
  282. self.objmap_object = make_sprite_object(self, self.sprite)
  283. self.signal_connect()
  284. self.properties = [
  285. StringProperty("Name", "name", "", optional=True),
  286. BoolProperty("Burning", "burning", optional=True, default=True),
  287. BoolProperty("Flicker", "flicker", optional=True, default=True),
  288. SpriteProperty("Sprite", "sprite", default=self.sprite, optional=True),
  289. ColorProperty("Color", "color", default=Colorf(1.0, 1.0, 1.0), optional=True),
  290. InlinePosProperty(),
  291. ]
  292. class Torch(GameObj):
  293. label = "Torch"
  294. identifier = "torch"
  295. sprite = "images/objects/torch/torch1.sprite"
  296. def __init__(self) -> None:
  297. super().__init__()
  298. self.objmap_object = make_sprite_object(self, self.sprite)
  299. self.signal_connect()
  300. self.properties = [
  301. SpriteProperty("Sprite", "sprite", default=self.sprite, optional=True),
  302. InlinePosProperty(),
  303. ]
  304. class DartTrap(GameObj):
  305. label = "DartTrap"
  306. identifier = "darttrap"
  307. sprite = "images/creatures/darttrap/darttrap.sprite"
  308. def __init__(self) -> None:
  309. super().__init__()
  310. self.objmap_object = make_sprite_object(self, self.sprite)
  311. self.signal_connect()
  312. self.properties = [
  313. FloatProperty("Initial Delay", "initial-delay", default=0, optional=False),
  314. FloatProperty("Fire Delay", "fire-delay", default=2.0, optional=False),
  315. IntProperty("Ammo", "ammo", default=-1, optional=False),
  316. DirectionProperty("Direction", "direction", 0),
  317. InlinePosProperty(),
  318. ]
  319. class WilloWisp(GameObj):
  320. label = "WillowIsp"
  321. identifier = "willowisp"
  322. sprite = "images/creatures/willowisp/willowisp.sprite"
  323. def __init__(self) -> None:
  324. super().__init__()
  325. self.objmap_object = make_sprite_object(self, self.sprite)
  326. self.signal_connect()
  327. self.properties = [
  328. SectorProperty("Sector", "sector", default="", optional=False),
  329. StringProperty("SpawnPoint", "spawnpoint", default="", optional=False),
  330. FloatProperty("Fly Speed", "flyspeed", default=64.0, optional=True),
  331. FloatProperty("Track Range", "track-range", default=384.0, optional=True),
  332. FloatProperty("Vanish Range", "vanish-range", default=512, optional=True),
  333. StringProperty("Hit Script", "hit-script", default="", optional=True),
  334. # ColorProperty("Color", "color"),
  335. InlinePosProperty(),
  336. ]
  337. class Dispenser(GameObj):
  338. label = "Dispenser"
  339. identifier = "dispenser"
  340. sprite = "images/creatures/dispenser/canon.png"
  341. def __init__(self) -> None:
  342. super().__init__()
  343. self.objmap_object = make_sprite_object(self, self.sprite)
  344. self.signal_connect()
  345. self.properties = [
  346. IntProperty("Cycle", "cycle", 2),
  347. EnumProperty("Type", "type", default=0, optional=False, values=["rocketlauncher", "cannon"]),
  348. BoolProperty("Random", "random", default=False, optional=True),
  349. BadGuyProperty("Badguy", "badguy"),
  350. DirectionProperty("Direction", "direction", 0),
  351. InlinePosProperty(),
  352. ]
  353. class Switch(GameObj):
  354. label = "Switch"
  355. identifier = "switch"
  356. sprite = "images/objects/switch/switch.sprite"
  357. def __init__(self) -> None:
  358. super().__init__()
  359. self.objmap_object = make_sprite_object(self, self.sprite)
  360. self.signal_connect()
  361. self.properties = [
  362. StringProperty("Script", "script", default=""),
  363. SpriteProperty("Sprite", "sprite", default="", optional=True),
  364. DirectionProperty("Direction", "direction", 0),
  365. InlinePosProperty(),
  366. ]
  367. class Platform(GameObj):
  368. label = "Platform"
  369. identifier = "platform"
  370. sprite = "images/objects/flying_platform/flying_platform-0.png"
  371. def __init__(self) -> None:
  372. super().__init__()
  373. self.objmap_object = make_sprite_object(self, self.sprite)
  374. self.signal_connect()
  375. self.properties = [
  376. StringProperty("Name", "name", "", optional=True),
  377. BoolProperty("Running", "running", default=True, optional=True),
  378. SpriteProperty("Sprite", "sprite"),
  379. PathProperty("Path", "path")
  380. ]
  381. class SpawnPoint(GameObj):
  382. label = "SpawnPoint"
  383. identifier = "spawnpoint"
  384. sprite = "images/engine/editor/spawnpoint.png"
  385. def __init__(self) -> None:
  386. super().__init__()
  387. self.objmap_object = make_sprite_object(self, self.sprite)
  388. self.signal_connect()
  389. self.properties = [
  390. StringProperty("Name", "name", "main"),
  391. InlinePosProperty()
  392. ]
  393. class SimpleObject(GameObj):
  394. def __init__(self, kind: str, sprite: str) -> None:
  395. super().__init__()
  396. self.label = kind
  397. self.identifier = kind
  398. self.sprite = sprite
  399. self.objmap_object = make_sprite_object(self, self.sprite)
  400. self.signal_connect()
  401. self.properties = [
  402. InlinePosProperty()
  403. ]
  404. class SimpleTileObject(GameObj):
  405. def __init__(self, kind: str, sprite: str) -> None:
  406. super().__init__()
  407. self.label = kind
  408. self.identifier = kind
  409. self.sprite = sprite
  410. self.objmap_object = make_sprite_object(self, self.sprite)
  411. self.signal_connect()
  412. self.properties = [
  413. SpriteProperty("Sprite", "sprite"),
  414. InlinePosProperty()
  415. ]
  416. self.constraints = [
  417. GridConstraint(32, 32, 16, 16)
  418. ]
  419. class WeakBlock(GameObj):
  420. label = "WeakBlock"
  421. identifier = "weak_block"
  422. sprite = "images/objects/weak_block/meltbox.sprite"
  423. sprite_linked = "images/objects/weak_block/strawbox.sprite"
  424. def __init__(self) -> None:
  425. super().__init__()
  426. self.objmap_object = make_sprite_object(self, self.sprite)
  427. self.signal_connect()
  428. self.properties = [
  429. BoolProperty("Linked", "linked", default=False),
  430. InlinePosProperty()
  431. ]
  432. class BonusBlock(GameObj):
  433. label = "BonusBlock"
  434. identifier = "bonusblock"
  435. sprite = "images/objects/bonus_block/bonusblock.sprite"
  436. values = [
  437. "coin",
  438. "1up",
  439. "custom",
  440. "explode",
  441. "firegrow",
  442. "icegrow",
  443. "light",
  444. "rain",
  445. "script",
  446. "star",
  447. "trampoline",
  448. ]
  449. def __init__(self) -> None:
  450. super().__init__()
  451. self.objmap_object = make_sprite_object(self, self.sprite)
  452. self.signal_connect()
  453. self.properties = [
  454. StringProperty("Message", "message", default="", optional=True, translatable=True),
  455. StringProperty("Script", "script", default="", optional=False),
  456. IntProperty("Count", "count", default=1, optional=True),
  457. EnumProperty("Contents", "contents", default=0, optional=True, values=self.values),
  458. SpriteProperty("Sprite", "sprite", optional=True),
  459. InlinePosProperty()
  460. ]
  461. self.constraints = [
  462. GridConstraint(32, 32, 16, 16)
  463. ]
  464. class InfoBlock(GameObj):
  465. label = "InfoBlock"
  466. identifier = "infoblock"
  467. sprite = "images/objects/bonus_block/infoblock.sprite"
  468. def __init__(self) -> None:
  469. super().__init__()
  470. self.objmap_object = make_sprite_object(self, self.sprite)
  471. self.signal_connect()
  472. self.properties = [
  473. StringProperty("Message", "message", "", optional=True, translatable=True),
  474. InlinePosProperty()
  475. ]
  476. self.constraints = [
  477. GridConstraint(32, 32, 16, 16)
  478. ]
  479. class Powerup(GameObj):
  480. label = "Powerup"
  481. identifier = "powerup"
  482. sprite = "images/engine/editor/powerup.png"
  483. def __init__(self) -> None:
  484. super().__init__()
  485. self.objmap_object = make_sprite_object(self, self.sprite)
  486. self.signal_connect()
  487. self.properties = [
  488. BoolProperty("Disable Physics", "disable-physics", default=False, optional=True),
  489. StringProperty("Script", "script", default="", optional=True),
  490. SpriteProperty("Sprite", "sprite", default=self.sprite, optional=False),
  491. InlinePosProperty(),
  492. ]
  493. self.constraints = [
  494. GridConstraint(32, 32, 16, 16)
  495. ]
  496. class ParticleSystem(GameObj):
  497. def __init__(self, kind: str, sprite: str) -> None:
  498. super().__init__()
  499. self.label = "ParticleSystem (%s)" % kind
  500. self.identifier = "particles-%s" % kind
  501. self.sprite = sprite
  502. self.objmap_object = make_sprite_object(self, self.sprite)
  503. self.signal_connect()
  504. self.properties = [
  505. ZPosProperty(),
  506. ]
  507. class Gradient(GameObj):
  508. label = "Gradient"
  509. identifier = "gradient"
  510. sprite = "images/engine/editor/gradient.png"
  511. def __init__(self) -> None:
  512. super().__init__()
  513. self.objmap_object = make_sprite_object(self, self.sprite)
  514. self.signal_connect()
  515. self.properties = [
  516. ZPosProperty(default=Layer.BACKGROUND0.value),
  517. ColorProperty("Top Color", "top_color"),
  518. ColorProperty("Bottom Color", "bottom_color"),
  519. ]
  520. class Background(GameObj):
  521. label = "Background"
  522. identifier = "background"
  523. sprite = "images/engine/editor/background.png"
  524. def __init__(self) -> None:
  525. super().__init__()
  526. self.objmap_object = make_sprite_object(self, self.sprite)
  527. self.signal_connect()
  528. self.properties = [
  529. FloatProperty("X", "x", default=0, optional=True),
  530. FloatProperty("Y", "y", default=0, optional=True),
  531. EnumProperty("Alignment", "alignment", default=0, optional=True,
  532. values=["none", "left", "right", "top", "bottom"]),
  533. FloatProperty("Speed (X)", "speed", optional=False),
  534. FloatProperty("Speed (Y)", "speed_y", optional=True),
  535. ImageProperty("Image (top)", "image-top", optional=True),
  536. ImageProperty("Image (middle)", "image"),
  537. ImageProperty("Image (bottom)", "image-bottom", optional=True),
  538. ZPosProperty(default=Layer.BACKGROUND0),
  539. ]
  540. class UnimplementedObject(GameObj):
  541. def __init__(self) -> None:
  542. super().__init__()
  543. self.sexpr = None
  544. def read(self, sexpr: Any) -> None:
  545. self.sexpr = sexpr
  546. def write(self, writer: SExprWriter, obj: Any) -> None:
  547. logging.debug("Unimplemented: " + str(self.sexpr))
  548. def property_dialog(self, parent: QWidget) -> None:
  549. pass
  550. class Door(GameObj):
  551. label = "Door"
  552. identifier = "door"
  553. sprite = "images/objects/door/door.sprite"
  554. def __init__(self) -> None:
  555. super().__init__()
  556. self.objmap_object = make_sprite_object(self, self.sprite)
  557. self.signal_connect()
  558. self.properties = [
  559. StringProperty("Sector", "sector"),
  560. StringProperty("SpawnPoint", "spawnpoint"),
  561. InlinePosProperty(),
  562. ]
  563. self.constraints = [
  564. GridConstraint(32, 32, 16, 16)
  565. ]
  566. class PathNode(GameObj):
  567. def __init__(self, node: ObjMapPathNode) -> None:
  568. super().__init__()
  569. self.node = node
  570. class ScriptedObject(GameObj):
  571. label = "Scripted Object"
  572. identifier = "scriptedobject"
  573. sprite = "images/engine/editor/scriptedobject.png"
  574. def __init__(self) -> None:
  575. super().__init__()
  576. self.objmap_object = make_sprite_object(self, self.sprite)
  577. self.signal_connect()
  578. self.properties = [
  579. StringProperty("Name", "name"),
  580. ZPosProperty(),
  581. BoolProperty("Visible", "visible", True),
  582. BoolProperty("Physics", "physic-enabled", False),
  583. BoolProperty("Solid", "solid", False),
  584. SpriteProperty("Sprite", "sprite"),
  585. InlinePosProperty(),
  586. ]
  587. class Wind(GameObj):
  588. label = "Wind"
  589. identifier = "wind"
  590. sprite = "images/engine/editor/wind.png"
  591. def __init__(self) -> None:
  592. super().__init__()
  593. self.objmap_object = make_rect_object(self, Colorf(0, 0.75, 0.75, 0.75))
  594. self.signal_connect()
  595. self.properties = [
  596. StringProperty("Name", "name", default="", optional=True),
  597. BoolProperty("Blowing", "blowing", default=True, optional=True),
  598. FloatProperty("Speed-X", "speed-x", default=0.0, optional=False),
  599. FloatProperty("Speed-Y", "speed-y", default=0.0, optional=False),
  600. FloatProperty("Acceleration", "acceleration", default=0.0, optional=False),
  601. InlineRectProperty(),
  602. ]
  603. class Pushbutton(GameObj):
  604. label = "Pushbutton"
  605. identifier = "pushbutton"
  606. sprite = "images/objects/pushbutton/pushbutton.sprite"
  607. def __init__(self) -> None:
  608. super().__init__()
  609. self.objmap_object = make_sprite_object(self, self.sprite)
  610. self.signal_connect()
  611. self.properties = [
  612. StringProperty("Script", "script", default=""),
  613. SpriteProperty("Sprite", "sprite", default="", optional=True),
  614. DirectionProperty("Direction", "direction", 0),
  615. InlinePosProperty(),
  616. ]
  617. # EOF #