hdnine's Forum Posts

  • tumira Thanks for the tip... worked perfectly. Didn't know about that feature. ^^

  • I sort of had the same thing but instead i was pasting like 40 lines of JSON code into the input box after which it looks like this:

    <img src="http://i.imgur.com/XZfyB08.png" border="0" />

    There doesn't seem to be any way to reverse since from now on all my input boxes look like this. :/

  • Right okay Ashley... I've been thought to instantiate objects when needed so to save on performance, but I guess that approach would work too. I'll consider using it thanks.

    EDIT:

    Oh... i see what you mean now. Works pretty good. ^^

  • I've been working a while now on a vertical shooter and it's time to try and figure out when and how to spawn enemies. My first thought was to store the data in an XML file which is read into the game on start. Then it hit me that this might be an unnecessary step since i can simple store all the data in a dictionary right? On top of all that, wouldn't external XML files be vulnerable to manipulation from the user?

    So anyway, I need to spawn certain enemies at certain points during the game -- like when the camera reaches Y position 4200 while moving up. What would you're thoughts be on this? When it comes to saving the game, then i would understand XML/JSON, but for simply reading in game data...

    Thanks!

  • So this is the way i solved the problem using a compromise. Since i was planing only to use full, half or quarter circles i did the following:

    Calculate Quadratic B?zier movment between point a, b and c (b is the control handle)

    x = (a.X*(1-t)^2 + b.X*2*(1-t)*t + c.X*t^2)

    y = (a.Y*(1-t)^2 + b.Y*2*(1-t)*t + c.Y*t^2)

    Calculate t for each frame while less than 1

    t = (obj.speed * dt) /((abs(a.X - c.X) * 2) * pi * (90/360))

    So far it seem to work really nice but i had to make a compromise because calculating the length of a more complex B?zier curve is way beyond my math knowledge. This is something that might bite me in the ass later if i decide to implement more complex enemy paths. We will see... ^^

  • I'm still trying to find a solution to this and math is not my strong side. As i understand it, getting a constant speed through a Bezier curve is impossible but you could get pretty close by calculating the arc length?

    The problem is that you can't have a Shoot em up without having some advanced patterns for the enemies and the only thing i can think of is using bezier curves. If anyone has any other suggestions that would be great ^^

  • I've been working on a vertical shooter and right now I'm tackling enemy A.I. using self constructed paths. I've got things working so that each enemy sets its next WP, the speed it should use to get there and if it should pause when reaching it.

    The thing is that all the movements are strictly linear and as you may know, this is hardly the case for enemy movement in vertical shooters. So i was playing around trying to implement B�zier curves which i had some real problems with. Eventually i got it to work using to points in space and one control handle, a Quadratic B�zier curve.

    The problem i have though is that the formula i got working isn't taking into account the enemy speed, but only moves along the curve by setting X/Y positions each tick. Secondly, this isn't time based animation taking into account the delta-time which will make the animation slower on slow machines. How can i implement a constant time based animation across a B�zier curve?

    This is the code I' am using:

    <img src="http://i.imgur.com/wpOrzY7.png" border="0" />

  • Wow! Less code and works much better... kinda disappointed of myself right now. =(

    Thanks for the link though. ^^

  • Hello again,

    I've been trying to replicate the effect of visualizing a swipe across the screen like the ones you might have seen in Cut the Rope and Fruit Ninja:

    <img src="http://i.imgur.com/6MxdQBB.png" border="0">

    While i was trying to figure out how these effects might have been done i came to the conclusion of two different approaches. Either you use vector graphics with a filled/stroked line with a variable sized stroke around it, OR, you use a succession of raster images tightly packed:

    <img src="http://i.imgur.com/Wb1KKzz.png" border="0">

    There are probably other, better, ways to go about this and i was hoping to get some input on the matter. Are any of these ways valid or is it better to try and calculate the distance between each two points and draw a line? If so, how can i get those lines as sloping graphics as you can see in the "blade" shapes of the above games?

    Since Construct 2 doesn't have any support for vectors i decided to try out the raster approach with this example:

    Swipe.capx

    While doing so i got the trail wrap-up effect to work as i wanted but the objects placed in succession are way to far apart as you can see with the large gaps in between them. This got me wondering about the frame rate that C2 can perform since, while touch down, i create a new object and place it at the touch X/Y.

    Anyway, please take a look at the attached file and give me your thoughts about how to approach this. Thanks!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • As i understand it, most games if not all of them, use either raster graphics or 3D. Many of these have their assets made as vectors first and are then later exported as raster PNG:s.

    The reason I'm asking is because i was playing two games that seem to utilize vector paths. Since Canvas do support basic draw functions, then maybe Construct 2 have some functionality that I'm not aware of? The games i was talking about are Fruit Ninja and Flight Control and how they both use some technique to trace graphics while swiping the screen:

    <img src="http://i.imgur.com/oyJALFH.jpg" border="0" />

    In the case of Fruit Ninja the swipe graphics look like raster but kinda "behave" like vector, so this got me a bit confused. Which is the common approach for creating graphics in smartphone and tablet games?

    Thanks! ^^

  • Just to let everyone know, this is how i solved the issue:

    <img src="http://i.imgur.com/YFlHAmf.png" border="0" />

  • Ok thanks guys... i'll try to figure it out ^^

    Thing is that the value 100 is sort of a strength value of how far out the player can shoot a projectile. Right now it's 100 pixels, after which it should be totally faded out and then removed. When the player later on progresses, this value might increase to more like 120 or 150 pixels.

    So i'm not to interested in how far it has come, more how many ticks has passed and at what value the opacity should decrease per tick. Maybe they are connected though... right now i'm just crying over my lack of math skills. >.<

    So:

    Each tick

    --> bullet.Opacity = bullet.Opacity - (what?)

    ...to get a smooth opacity decrease from 100 to 0 over my set distance.

  • I hate that I'm so lousy at math and this is something i struggle with all the time. In my game i wanted to calculate how much the opacity for my bullet object has to decrease per tick, starting from 100% and going down to zero over a distance of 100 pixels.

    Right now i know the following:

    Bullet speed: 150 pixels/sec

    Travel distance: 100 pixels

    Current opacity: 100%

    Delta time (dt)

    As i understand it, i need to calculate the speed the bullet takes to travel over the set distance which should be time = distance/speed. So 100/150 = 0.66 pixels/sec right?

    But this is only how far it moves each second, so to calculate the distance each tick (to get frame based animation) you probably have to do 0.66 * dt? This gives me approx 0.0106 pixels/tick...

    This is where it gets confusing and I'm sure that i've approached the whole thing wrong up until now... but how do i know how much the opacity should decrease each tick? <img src="smileys/smiley5.gif" border="0" align="middle" />

  • Hey everyone!

    I've been trying to make my enemies bounce while moving forward towards the player. This means moving in both X and Y directions and please note that this is NOT a platform game so there aren't any solid platforms to stand on. It's more of a top-down game and below is my current code:

    <img src="http://i.imgur.com/A4KITrJ.png" border="0" />

    At the moment I can see this working in one out of two ways:

    1.) I use gravity and make the enemy jump up. The problem is that the bounce needs to be stopped where it started (in Y axis) and this is the way i have it now -- a nice bounce in place effect. The problem is that the enemy can't move in the Y axis towards the enemy because this interferes with the bounce. Also the gravity messes things up.

    2.) I make an animation that looks like a bounce and then move the enemy towards the player by calculating distance and the amount to move each frame. While doing this i just run the animation over and over. The problem with this is that the animation only can change one pixel per step so it becomes very jerky.

    I would prefer to have it bounce "naturally" by utilizing gravity since i believe this would look smoother, but since there are no platforms or solids to bounce on, this has presented a problem for me. Any suggestions would be awesome!

  • Ok thanks ^^