How do I draw shape and fill itself if unfinished?

Get help using Construct 2

Post » Wed Dec 17, 2014 4:27 pm

I am a begginer (complete newbie btw), wanting to make a game were you draw a shape with limited use of ammount of area per total shapes ingame and after the shape is drawn by mouse input it is filled and closed automaticaly and falls into ground. I know its a hard one, but this question is driving me nuts finding a game engine that makes this easier, tried gamesalad and stencyl... Any clues guys?

oh, i tried the polygon plugin! nope, its not like that what I want.
B
4
Posts: 9
Reputation: 218

Post » Fri Dec 19, 2014 8:09 am

I'm afraid using the construct 2 engine this is not possible, you could create a script externally that changed the source files to whatever you want, but it's still not practical, you could use animation frames but that's not really practical either. If you cannot find any game engines that fit your genre of game, you could always learn to make a game from scratch. I personally would recommend coming up with a new game concept
B
8
S
2
Posts: 41
Reputation: 643

Post » Fri Dec 19, 2014 4:01 pm

this brings me back to my old days of Amstrad coding... anyway

if the shape is regular (ie a box) then you could build a filling routine where you fill it up with predefined polygons (say a 1x1 image, or even better a 1x1 image that you can stretch to a width). what you do is a bit like a path-finding algorithm... you figure which side of the line is your box... and then you move left and right to find an edge (c2 can do that) and then you can move up and down. or you can travel along an edge and infill. It begins to fail with complicated shapes, and it will not be fast as writing it natively.

it's not easy but it is doable. I suspect it's beyond a beginner

PS: as an early newbie, I never got my fill algorithms to work correctly.
B
7
S
3
G
1
Posts: 184
Reputation: 1,352

Post » Fri Dec 19, 2014 5:50 pm

ok guys, its as I suspected, but say I wanna simplify things and want to just create a square by making the diagonal (dragging like in photoshop or illustrator and create and fill the square) is it possible with the help of a plugin? I just need to make a good function for this game and easing the process with a plugin would be more doable... thanks for the answers anyway!
B
4
Posts: 9
Reputation: 218

Post » Fri Dec 19, 2014 6:48 pm

Why not use the polygon object? It makes it very easy to draw a polygon. For example:
Code: Select all
on mouse left click
--- polygon: clear polygon

left mouse button is down
--- polygon: add vertex at (Mouse.x, Mouse.y) -world-space

on left mouse button released
--- polygon: draw polygon ...

It doesn't play well with the physics behavior but at least the collision polygon will match the drawn polygon.

You could also draw the polygon using the canvas plugin but it has no collision polygon.

So drawing it isn't what's hard.


For just a box no third party plugin is needed. Only the mouse and a sprite with the origin centered.
Code: Select all
global number startx=0
global number starty=0

on left mouse click
--- set startx to mouse.x
--- set starty to mouse.y
--- create Sprite at 0,0

left mouse button is down
-or-
on left mouse released
--- Sprite: set position to ((startx+mouse.x)/2, (starty+mouse.y)/2)
--- Sprite: set size to (abs(startx-mouse.x), abs(starty-mouse.y))

If you want it to fall afterwards you could use the physics behavior, only be sure to disable it until the mouse button is released.

If you want a box then no plugin is needed
B
94
S
33
G
113
Posts: 5,356
Reputation: 73,273

Post » Fri Dec 19, 2014 8:11 pm

thanks R0J0hound, managed to do it by making the secnd option: generating the sprite, two questions now... my sprite should be with limited use in my game, like, I just could use 3/4 of them, but what is happening is that the old sprite disapears when i click other area and generates a new one ( the same but in other position). That is a thing I wish this game to have, the other one is: Im not managing to get it to fall, I disable the behaviour of phisics, then what? I aplied that to the sprite.
B
4
Posts: 9
Reputation: 218

Post » Fri Dec 19, 2014 8:53 pm

Here's a capx. I used "pick top instance" to pick only the last box created
You do not have the required permissions to view the files attached to this post.
B
94
S
33
G
113
Posts: 5,356
Reputation: 73,273

Post » Sat Dec 20, 2014 9:29 pm

sorry that is for version 192, and I have the latest free version wich is 190. how to bypass this? I just clicked the capx to ope, am I doin it wrong?
B
4
Posts: 9
Reputation: 218

Post » Sat Dec 20, 2014 9:37 pm

B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Sat Dec 20, 2014 10:18 pm

thanks korbaach
B
4
Posts: 9
Reputation: 218

Next

Return to How do I....?

Who is online

Users browsing this forum: brunopalermo and 15 guests