# How do I

Get help using Construct 2

### » Sat Dec 19, 2015 4:55 am

Hello guys,
do you know how to make a drawing game? Like "BrainDots" , draw shapes as you wish and also with physics.
Or without physics but I need to know.
Best regards and happy holidays!
B
4
Posts: 7
Reputation: 218

### » Sat Dec 19, 2015 5:43 am

Well I know of one way, is to

On Mouse is down event>>
create your sprite at mouse.X/Mouse.Y or Mouse.X(0)/Mouse.Y(0)

But, for a game LIKE the one you mentioned, you'd have to learn trigonometry or some kind of middle ground of hitting certain button combos and checking length and distance and size of a sprite to manipulate it like a rope and freeze its position. I'm totally unsure. I know there are some rope examples available that deal with free form shapes. You could perhaps try spawning shapes a certain size and length while mouse button is down and when on first mouse button is clicked set shape and length to initial change dir x of mouse and then width to a default size and for change in mouse X and Y since movement calculate shift and shift in change to make the newly spawned sprites take a length or shape of a more square or rectangle depending on the change in shift x and Y.

Something:
Code: Select all
`On Mouse button is down>>>begin a .. loop? hmmm dont know, a function that continously loops and compares the x and Y current?Ok first make 2 variables (globals, or locals) named CurX and CurY) and a MouseTracker object and set it to always folow your mouse.X and Y or Mouse.X(0) and Mouse.Y(0) which I find most reliable.. usually)Every tick>>>CurX: Mouse.XCurY: Mouse.YEvery tick >>>set  MouseTracker position: MouseTracker.X to Mouse.X, MouseTracker.Y to Mouse.YEvery tick >>>Set MouseTracker.MouseXVar to Current Mouse.XSet MouseTracker.MouseYVar to Current Mouse.YEvery tick>>> (all events below go off MouseTracker object vars)CurX!= MouseXVar >>CurY!= MouseYVar >>set CurX to MouseXvarset CurY to MouseYvar Every 1 second >>>Set LastMouseX to Mouse.XSet LastMouseY to Mouse.Y Every 2 second>>> (all events below go off MouseTracker object vars)MouseXvar != LastMouseX>>MouseYvar  != LastMouseY>>set LastMouseX to MouseXvarset LastMouseY to MouseYvar On Mouse button is down>>>every tick >>>>//(applied to some variable or mouse tracker.. which could be constantly setting itself to the mouse itself) begin function funcMouseDraw(param0: MouseXVar, param1: MouseYVar, param2: LastMouseX, param3: LastMouseY)Localvars for function:Localfunc1:Localfunc2:Localfunclast1:Localfunclast2:(dont quote me on this, you may not want to store the variable locally as it may not update, make them static as it seems to help witht his, otherwise dont bother as you can just test the functions params.)On function funcMouseDraw>>>set Localfunc1 to funcMouseDraw.param0()set Localfunc2: to funcMouseDraw.param1()set Localfunclast1 to funcMouseDraw.param2()set Localfunclast2: to funcMouseDraw.param3()1st level SubEvent--->>MouseTracker.CurX == Localfunclast1 >>&&MouseTracker.CurY == Localfunclast2 >>&&Not overlapping an objectSpriteDrawcreate objectSpriteDrawset objectSpriteDraw width to: <some default shape value here>set objectSpriteDraw height to: <some default shape value here.. for your default draw shape, using whatever the sprite is>elseMouseTracker.CurX(or localfunc1) == Localfunclast1 >>&&MouseTracker.CurY(or localfunc2) == Localfunclast2 >>&&Is overlapping an objectSpriteDraw<Do nothing>else MouseTracker.CurX == Localfunclast1 >>&&MouseTracker.CurY != Localfunclast2 >>&&Not overlapping an objectSpriteDrawcreate objectSpriteDrawset objectSpriteDraw width to: <some default shape value here>set objectSpriteDraw height to: <default shape + or - the change in Y using localfunclast2>`

Anyway, this is a rough idea on how to approach this

-- See, it doesnt help that Construct 2 has no access to the graphic renderer. So we cant draw simple sprites (like real ones) We have a sprite object class which has parameters we pass and is an object.
B
5
S
1
Posts: 68
Reputation: 515