Here's a capx since I admit there is some ambiguity with what I typed.
https://dl.dropboxusercontent.com/u/5426011/examples17/target_specific_instance.capxr124
Yann you can also write it like this to eliminate repetitive events:
+ system: every tick -> system: set i to 0 + system: while -> text: append i to text -> system: add 1 to i + [inverted] system: i < 10 ->system: stop loop
shimo you could do it like this:
+ system: every tick -> system: set x to 10 -> system: set random_var to 0 + system: while -> system: set random_var to int(random(100)) + system: random_var==4 -> system: set x to 10/random_var + [inverted] system: x == 2.5 ->system: stop loop
The level array you are using is 256x256 but the layout size is 2048x2048. Since 256*16=4096 the layout size should be 4096x4096. Do that and the player won't wrap before reaching the blocks. You can also make the terrain generate higher by changing the values set to terr in event 11, but that completely kills the framerate for me.
Arrays in Construct Classic are one based so the correct syntax would be:
{"me","you","we"}@(random(3)+1)
because random(3)=0,1,2
I'm not sure if that fixes your issue but it should help.
Couldn't you just use the LayoutName expression with a system compare?
You need to use the "pick by uid" condition of "block" instead of the system condition to pick an object instance.
You don't need an array for this. Use a Sprite for the blocks as you said and give them an instance variable for the state. You can then make the grid of blocks by placing them in the editor or with events.
global number grid_top=10 global number grid_left=100 start of layout for "row" from 0 to 9: for "col" from 0 to 9: --- create block at (loopindex("col")*block.width+ grid_left, loopindex("row")*block.height+ grid_top)
Then you can do the targeting by saving the uid of a random block to a global variable. Then with events only check for bullets hitting that instance.
global number target=-1 target = -1 pick a random block instance --- set target to block.uid every 1.0 seconds pick block with uid target --- "have the enemy shoot at block" pick block with uid target block is overlapping bullet --- destroy bullet --- subtract 1 from block state block state<=0 --- destroy block --- set target to -1
Iggyboo
My canvas plugin can be used for dynamic images and per pixel collision detection. It's not as simple as it could be but here are all the examples I could find:
http://www.scirra.com/forum/how-do-i-simple-worms-game_topic47872_post300449.html#300449
http://www.scirra.com/forum/destroy-Objects-parts_topic61035_page2.html
http://www.scirra.com/forum/destructible-terrain-better-ideas-than-this_topic55053_post344054.html#344054
Two of those have some kind of terrain generation if that helps.
Develop games in your browser. Powerful, performant & highly capable.
was wondering if there is any compendium of the Construct syntax...
http://sourceforge.net/apps/mediawiki/construct/index.php?title=Expressions
Allow me to disagree about the difficulty of a turn based game. The state of who's turn it is can be represented in a variable. Then use the variable compare condition in events to control when things happen. That is pretty much the main aspect that makes it turn based.
After that you can tackle each other aspect individually. The computer AI will be the most difficult but is doable.
Do you mean you want to spawn a random object out of a set of objects?
If so you could use the "create object by name" action and use
{"man", "woman", "monster", "kid"}vxc@(random(4)+1)[/code] as the object type.
"kid"}vxc@(random(4)+1)[/code] as the object type.
Well it would appear that find() does case insensitive searching, so "a" is the same as "A". So we have to work around that. Dictionaries have case sensitive keys so we can use that.
First populate the dictionary with all the keys:
global string chars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-.,:;'""?!()" start of layout repeat len(chars) times --- Dictionary: add key mid(chars,loopindex,1) with value loopindex
Then change the formula to:
Dictionary.Get(mid(Text.Text, loopindex, 1))
Member since 15 Jun, 2009