Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by coreysnyder

I've written games in the past and in some cases I would just use a draw function to draw a line from point A to point B. How is this accomplished in Impact? Do you override the draw() function?

Essentially what I'm trying to do is put a dot where the user first clicks, and draw a line to a dot where the user moves their mouse to. Or on mobile clicks and drags a finger to. So if you clicked and drug your finger down and to the left, you'd see a dot where you initially clicked, and a line drawn to a dot under your cursor.

As far as the dots go, I was just going to create a dot (a sprite with a dot) entity and spawn it under the mouse click. Then spawn a second dot entity which will track the to the users mouse. Where I'm stuck is how to draw a line between the two. Any help would be appreciated.

1 decade ago by paulh

http://impactjs.com/forums/help/drawing-a-laser-beam-effect

Thats the basics, obviously tweak it to use the co-ordinates you want using

ig.input.mouse.x,ig.input.mouse.y


The line wont draw using IOSIMPACT unless your going through some other third party like cocoon or appmobi.

1 decade ago by coreysnyder

I purchased impact through appmobi. Have they solved many of the issues that usually pop up when trying to push to iOS?

1 decade ago by paulh

I hate to say but im totally confused by appmobi .. but im pretty sure they support line drawing/canvas drawing on IOS .. so you should be fine :-)

I think you get a good performance hike from direct canvas and of course multi channel sound, which is pretty much essential for games ...

1 decade ago by quantum

@paulh: Do you mean the 3rd party lib (e.g. appmobi) will intercept the line drawing function call? Or are you talking about specifically calling their APIs for line drawing?

1 decade ago by quantum

Sorry, what I meant to say was surely the 3rd party SDK would implement a fast version of ig.system.context.lineTo() which would mean you wouldn't have to make any code changes for your game to work with their SDK.

1 decade ago by Jerczu

iOS impact has a limited version of canvas rendering implemented as far as I am aware Dominic is working on extra features like native drawing (saw something on his blog). You might want to try AppMobi or CocoonJS
Page 1 of 1
« first « previous next › last »