"Action" Blocks

Propose new features or changes.

Moderators: SMC Team, MVP

"Action" Blocks

Postby -DarkAceZ- » 24 Jan 2011 20:34

Blocks that are there and when you do something like defeat a boss they disappear. Or the other way around, they aren't there, you do the action and they appear, creating a platform so you can move on. (I thought we could select the action type? Appear/Disappear)
User avatar
-DarkAceZ-
Maryo small
Maryo small
 
Posts: 1063
Joined: 28 Oct 2010 17:24
Location: The Level Editor

Re: "Action" Blocks

Postby BowserJr » 24 Jan 2011 20:56

We definitely need a subforum of Feature Requests for "Things that will be better done with scripting". :P
"Plants need to have water poured on them because they have no hands to hold glasses of water."
User avatar
BowserJr
SMC Team
SMC Team
 
Posts: 1543
Joined: 05 Feb 2007 14:07
Location: London, UK

Re: "Action" Blocks

Postby -DarkAceZ- » 24 Jan 2011 21:23

Truth is, I don't know exactly how scripting works, and how easy it is.
User avatar
-DarkAceZ-
Maryo small
Maryo small
 
Posts: 1063
Joined: 28 Oct 2010 17:24
Location: The Level Editor

Re: "Action" Blocks

Postby Luiji » 24 Jan 2011 21:41

Essentially, scripting works like this:

All objects have a series of "events" attached to them. Such events include OnDie, OnCollideWithPlayer, OnCreate, OnHit, etc. What you do is attach a "script" to the event, which is a chunk of code that will effect the game in some way.

Example:

There is a furball boss. You deactivated automated winning and instead attached the following script (I've switched back to Lua for scripting, by the way, based on recommendation from other game devs):

Code: Select all
local door = Door:new(500, 500) -- create new door at 500x500 using default door image
door:setImageDir("game/door/blah/blah/blah") -- change the graphic
door:register() -- add the door to the level

local exit = LevelExitBeam:new(500, 530) -- create new level exit beam
exit:register() -- add beam to the level


So when you defeat the furball boss, a new door to exit the level will be created!

By the way, we should add a new [ lua ][/ lua ] BBCode element to give Lua code syntax highlighting (and one for C++, [ cxx ][/ cxx ], too).
Custom Built IBM-Compatible (Arch Linux w/ KDE)
Dell Vostro (Windows 7)
Dell Inspiron 1440 (Windows Server 2003, Debian w/ KDE)
Dell Inspiron 11z (Linux Mint)
Luiji
MVP
MVP
 
Posts: 2703
Joined: 14 Jan 2010 23:20
Location: The Mushroom Kyngdom

Re: "Action" Blocks

Postby -DarkAceZ- » 24 Jan 2011 23:23

Luiji wrote:Essentially, scripting works like this:

All objects have a series of "events" attached to them. Such events include OnDie, OnCollideWithPlayer, OnCreate, OnHit, etc. What you do is attach a "script" to the event, which is a chunk of code that will effect the game in some way.

Example:

There is a furball boss. You deactivated automated winning and instead attached the following script (I've switched back to Lua for scripting, by the way, based on recommendation from other game devs):

Code: Select all
local door = Door:new(500, 500) -- create new door at 500x500 using default door image
door:setImageDir("game/door/blah/blah/blah") -- change the graphic
door:register() -- add the door to the level

local exit = LevelExitBeam:new(500, 530) -- create new level exit beam
exit:register() -- add beam to the level


So when you defeat the furball boss, a new door to exit the level will be created!

By the way, we should add a new [ lua ][/ lua ] BBCode element to give Lua code syntax highlighting (and one for C++, [ cxx ][/ cxx ], too).

uh, yy-yeah, ok. kinda cant wait until-l s-scripting is-s i-in the g-game... wut :|
User avatar
-DarkAceZ-
Maryo small
Maryo small
 
Posts: 1063
Joined: 28 Oct 2010 17:24
Location: The Level Editor

Re: "Action" Blocks

Postby smc_gamer » 25 Jan 2011 02:12

So comments will be indicated by two dashes? Sounds great. I also like the syntax, it looks pretty easy.
smc_gamer
Blog | "If good things lasted forever, would we appreciate how precious they are?" -Hobbes
User avatar
smc_gamer
Static Saw
Static Saw
 
Posts: 245
Joined: 15 Aug 2010 13:49
Location: United States

Re: "Action" Blocks

Postby penguin » 26 Jan 2011 22:57

I don't even know any programming languages and I understand it competely!
my wiki page
I may disappear for a long time, but trust me, I'm still alive.
User avatar
penguin
Turtle boss
Turtle boss
 
Posts: 665
Joined: 14 Nov 2009 14:37
Location: Nebraska

Re: "Action" Blocks

Postby Luiji » 31 Jan 2011 20:39

This is good to know. :D
Custom Built IBM-Compatible (Arch Linux w/ KDE)
Dell Vostro (Windows 7)
Dell Inspiron 1440 (Windows Server 2003, Debian w/ KDE)
Dell Inspiron 11z (Linux Mint)
Luiji
MVP
MVP
 
Posts: 2703
Joined: 14 Jan 2010 23:20
Location: The Mushroom Kyngdom


Return to Feature Requests

Who is online

Users browsing this forum: No registered users and 1 guest

cron