R0J0hound's Recent Forum Activity

  • I imagine it would kill the performance. Right now only the first wall hit per cast ray is used. It can be changed so that a order list of walls hit is used, which shouldn't affect performance too much.

    The bottleneck will be the rendering. Right now one sprite is used for each vertical slice. With half walls more than one sprite will be needed per slice. I thought of using only 1 sprite and pasting it many times to a canvas object for the drawing, but I'm not sure if that would improve performance.

  • For snapping to an iso grid first convert the mouse coordinates into isometric:

    isoX = MouseY + MouseX / 2

    isoY = MouseY - MouseX / 2

    But to snap to a grid you need to do math like this: round(n/32)*32

    isoX = round((MouseY + MouseX / 2) / 32 - 32) * 32

    isoY = round((MouseY - MouseX / 2) / 32) * 32

    Note: the -32 in bold to correct the hotspot being on the top left.

    Then convert back to regular coordinates:

    X = isoX - isoY

    Y = (isoX + isoY) /2

    aznmonkeyboy

    Changed my example a bit so that scrolling isn't faked. The tiles are just moved to the other side when they leave the screen. This should be as easy to work with as if all the tiles existed at once.

    http://dl.dropbox.com/u/5426011/examples11/tileScroll2.cap

    I'm still using sprites, it's just a preference. Sprites provide the luxury of hotspots so you can easily have different height tiles. TledBackgrounds have the advantage of rendering almost twice as fast as sprites, but I'm getting a constant 60 fps so it's fast enough.

  • ow can I constantly update my tile map while moving around?

    Here is a example of a 1000x1000 tile map displayed with 429 sprites.

    http://dl.dropbox.com/u/5426011/examples11/tileScroll.cap

    The sprites don't actually move only the tile they represent changes. Scrolling the layout a bit completes the illusion of scrolling over the tiles.

    Also, does anyone have a circle or polygonal loop circuit or function on hand?

    I don't understand this. Do you mean motion in a circle or along a polygon path? Please clarify.

    solar

    I don't have visual studio installed atm, so I can't tinker with the Texture Setter source right now. But it should be possible to get it to work with tiledBackgrounds, in fact I'm pretty sure I had it working at some point when I was making it.

  • The path is wrong.

    Instead of XML.StringValue("/tesult/text()")

    do XML.StringValue("/test")

  • Not with the text object, but you could try the spritefont plugin if you want more control of the text appearance:

    http://www.scirra.com/forum/plugin-spritefont_topic45876.html

  • You can do it with two events using the compare x condition.

    Player X < Mouse.X

    ----- Player set mirrored

    Player X > Mouse.X

    ----- Player set not mirrored

  • 1d array = a spreadsheet with just 1 column but however many rows you want

    a 2d array = a spreadsheet with 2 columns and however many rows.

    a 3d array = a spreadsheet with 3 columns and however many rows.

    1d is correct but 2d and 3d are more like this:

    a 2d array = a spreadsheet with however many columns and however many rows.

    a 3d array = a spreadsheet with however many columns and however many rows and however many pages.

  • Looking at the code it just checks every pair of objects for a collision. It compares bbox first, then rotated box, and poly collisions last. When using behaviors such as 8-direction, the object is compared with every soild object. When using the "is overlapping" condition of sprites only the picked objects are used in the comparison, so you could do some sort of quadtree or spacial hash in events before using "is overlapping".

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • change random(7) to int(random(7)) so only whole numbers are used 0,1,2,3...

  • Jayjay

    I split everything up into vertical slices: screen and textures. Then with a bit of math I calculate what texture slice to use for a screen slice.

    aridale

    It's good to hear that you're getting 30fps. I only get 5-12fps on my rig. I may be able get a speedup by going back to 90 degree walls on a grid.

  • darksteeldanger

    The first post I made in this topic has a link that explains it somewhat.

    Basically what I did is make a top view game. Then I made a sprite for each vertical line across the screen. Then the player on the top view shoots a spread of bullets, one for each vertical line. When a bullet hits a wall then the corresponding vertical slice is made visible and it's height is set to 100*1/distance(bullet, player).

    For the 2nd example I used the math here to find more precise wall intersections.

    http://paulbourke.net/geometry/lineline2d/

    For the texture I first split it into a frame per vertical slice. Then when the bullet(or ray) hits a wall I calc what texture slice to use by where on the line is hit.

    New version with more fixes:

    * multiple textures

    * commented

    * changed walls from lines to polygons.

    https://www.dropbox.com/s/czgsjbqz6lubf ... .capx?dl=1

    /examples11/raycast3.capx

  • Wastrel Thanks.

    Here is an improved example with:

    * textured walls

    * more precise wall/ray intersections

    * angled walls

    https://www.dropbox.com/s/lvox71xpnpvlg ... .capx?dl=1

    /examples11/raycast2.capx

R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 155 followers

Connect with R0J0hound