R0J0hound's Recent Forum Activity

  • It’s probably not random.

    You sound like you have a specific behavior you’re after that you have footage of or have seen. You could start by examining the motion of one leaf and trying to break it down into a path that you could replicate somehow. Worst case you could maybe use a timeline to manually plot a path. With two or three varieties you may get enough variation.

    At the other end of complexity you could try some grid based fluid dynamics to model airflows. Then the leaves would move based on where they were within it since you would have velocity at any point. Then you could model the leaves as slightly curved apply the wind to them based on the angle the wind hits them.

    There are probably many options in between. I don’t have any specific examples in mind though.

  • You don’t want to use Sprite.width since it’s changing. Worst case just use a fixed number such as 64 or whatever width you want it to start at when not rotated.

    I guess it’s sprite.ImageWidth not originalWidth.

  • Interesting take to consider the 0-255 range a relic. It’s standard to represent a pixel with a 32bit integer or 8bits (0-255) per component. That’s used in textures, the screen and when you snapshot a drawingCanvas.

  • Probably just:

    Var rotY=0
    
    Every tick
    — add 50*dt to rotY
    — sprite: set width to self.originalWidth*cos(rotY)

    Also it’s probably not necessary to post the question twice in both the c2 and c3 sections. The forum is already slow and most just look at new posts so they’ll see the question no matter where you post it.

  • Wouldn’t it be simpler to just save the type and position of each card?

    Global text data=“”
    
    On function save
    — set data to “”
    — for each card ordered by card.zindex ascending
    — — add card.x&”,”&card.y&”,”&card.animationframe&”;” to data
    
    Global text tok=“”
    
    On function load
    Repeat tokencount(data,”;”)-1 times
    — set tok to tokenat(data,loopindex,”;”)
    — create card at float(tokenat(tok,0,”,”)), float(tokenat(tok,1,”,”))
    — card: set animation frame to int(tokenat(tok,2,”,”))
  • Here's an example. I think it's cool the planes never collide.

    dropbox.com/scl/fi/yzoz4teghe9etfoa2qml8/flower_path.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I only use the free version but generally nwjs is not equal to webview2. Namely webview2 hasn’t implemented all the features available in nwjs.

    So basically file a few feature requests for the webview2:

    * be able to hide toolbar

    * fix window.open(url,””,”popup”) to open a new window instead of a new tab.

    Changing the title should be simple in js with:

    window.document.title = “new title”;

    You can also change the title of the popup window with:

    let popup = window.open(url,””,”popup”)

    popup.document.title = “new title”;

    Or you can change it in the html page from the url.

    If that doesn’t work with the webview2 export then file a third issue. Or you can also stay with nwjs.

    Having the two windows interact is up to you. In JavaScript you have access to the popup window to be able to call functions as seen above. And from the popup window you have access to the parent window with window.opener. You can do what you like with that.

  • I’d argue that the web has an inadequate feature set for that. Window.open() can create a separate window but it’ll have to be an entirely different page, it can’t just render parts of the existing project. You’ll probably need to load the same project twice and somehow communicate that the new instance should be a toolbar, or you’d have a specific project per sub window. Also you’re limited with how you can customize the window. It would be dependent on extra features provided by nwjs or webview2 if any. By default the popup window includes a title bar and the url bar and you can’t remove them.

    To communicate between the two you can just utilize some js functions. Basically when you create a window with window.open() it returns the window’s global scope.

    You can transfer things between the two any way you like but you could look into the drag drop api to see if that’s useful.

    developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API

    You won’t be able to do stuff like dragging the toolbar of the window to do that though. The browser just doesn’t provide access to such things. More is theoretically possible in a wrapper such as nwjs but even that doesn’t provide stuff like that. Overall not much is implemented to help with that.

  • Changing the timescale wouldn’t do anything about making it run faster, and ideally you wouldn’t use any waits. Wait 0 is a handwavy way to address a quirk with the picking system related to when stuff is actually destroyed or when created objects are generally pickable. It’s not that it takes time to happen, it’s more that the objects are actually added/removed from the object lists in between top level events (events that aren’t sub events of anything).

    Anyways another benefit of using an array is you avoid all the nuance when dealing with picking.

  • Have you tried not using a behavior and moving the object directly with the polar equation r=a*cos(2*theta)?

    Something like:

    Var theta=0

    Var rot=0

    Every tick

    — sprite: set position to 320,240

    — add 30*dt to theta

    — sprite: move 200*cos(2*theta) pixels at angle theta+rot

    That will move it along the path and it starts on a leaf. You can rotate the whole path with the rot variable.

    You can also change the angle of the sprite to be at the angle its moving by saving the old position before moving and setting the angle to angle(prevX,prevY,x,y) after you move it.

  • What have you tried? There is a rotate action for the sprite object. Run that every tick and it will rotate and change the angle of motion of the bullet behavior. You can just fiddle the number till it’s rotating a satisfactory rate. You can also incorporate dt so it will rotate consistently no matter the frame rate. For example rotating by 100*dt will make it rotate 100 degrees per second