R0J0hound's Recent Forum Activity

  • 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

  • This page describes how to do ray casting:

    http://lodev.org/cgtutor/raycasting.html

    Here's a crude implantation:

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

    /examples11/raycast.capx

    I have a slow computer so I made the example with a small display.

  • Use this version of S:

    http://www.scirra.com/forum/forum_posts.asp?TID=38456&PID=232780&title=s-update-as-of-4-12-11#232780

    and the example works without crashing.

    hmmm. I know this is messy, but for now, you have to download the versions you see on each page as you go through the tuts

    I never updated them all to work with the latest version

    ...

    http://www.scirra.com/forum/forum_posts.asp?TID=38456&PID=271922&title=s-update-as-of-4-12-11#271922

  • Here's the capx:

    http://dl.dropbox.com/u/5426011/bug/r90_minify_bug.capx

    Previewing and exporting without minify works as expected; "abcd" is appended to the Text. But when exporting with minify only "ab" is appended.

    If I replace "on any key pressed" with another trigger (other than "start of layout") it still occurs. Also if I replace "repeat" with another looping event such as "for" it still occurs.

    Construct 2 R90

    Winxp pro sp3

    Firefox 12.0

  • heater19

    Yeah... I agree I left out my my logic for the fix, which makes it not very helpful. So here's my trail of thought:

    Events 5-7 in your original capx only filtered the "Sprite" object. "Sprite2" is unfiltered and only the first instance of "Sprite2" is used in the expressions. "Text" is also not filtered. So it runs like this:

    if "Sprite" is CW from the first "Sprite2" then set all the "Text" objects' text to 'Left'.
    if "Sprite" is CCW from the first "Sprite2" then set all the "Text" objects' text to 'Right'.

    Relevant section of manual: http://www.scirra.com/manual/75/how-events-work

    So there are two problems.

    1. Only the first "Sprite2" is being compared against. Changing "Every tick" to "for each Sprite2" in event 5 fixes that.

    2. All the "Text" objects are getting set to the same value. What is needed is a way to be able to pick the "Text" that's paired with "Sprite2". Unfortunately he pin behavior doesn't cause the pinned objects to be picked, so some other method needs to be used.

    I like using a instance variable to store the UID of another object, so that the paired object can be picked at any time with "pick by UID", but that is not the only solution. You could alternatively use

    Text|Pick nearest to (Sprite2.X, Sprite2.Y)

    or

    System|pick Text instance Sprite2.IID

    and you would avoid the need for an additional variable.

  • That is an interesting idea. Get a map generator going first. Each room only needs to know in what direction the doors are. For simplicity the doors could always be at the same locations. Then have it pick a random designed room with the same exits.

    Instead of having each designed room on a separate layer, put them on a separate layout, it makes it a bit simpler for designing. In my example the first thing the game does is run each room layout and save each objects position and size into a global array per room. I did this so that I can pick at runtime a room according to the directions of it's exits.

    I didn't do this in my example but having the room data stored in an array makes it easy to implement loading/unloading of rooms all in the same layout, so you can have massive layouts and not have to worry about high object counts bogging down the framerate.

    Here is an implementation of my ideas:

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

    /examples11/rooms2.capx

    The bare minimum amount of rooms is 15, I used 30 so that each possible room has 2 variations.