randomly's Forum Posts

  • Hey R0J0hound,

    just discovered this thread when searching for an impact prediction for a bullet-behaviour-controlled object.

    I tried to apply your calculations to my project, but that didn't quite work out, since my setup is a bit different compared to yours.

    Can you help me with this? (Image of current setup further down)

    I have the following scenario:

    A projectile with the bullet behaviour gets shot from a specific angle (and a slightly elevated position) at a specific initial speed (400) and gets dragged down by the bullet's gravity (450).

    So the thing is, I don't set the initial horizontal and vertical speed with the mouse, but with the bullet's initial speed.

    I want to mark the impact point on the ground (at a specific y = 570) with a sprite.

    So I tried to set the sprite's position to posx,570, after repeating the loop 11 times.

    The sprite was somewhere near the impact point, but nowhere near the accuracy in your example.

    My question to you is now:

    To which number should I modify the loop count and do I even need a step value, since I don't need any trajectory displayed?

    Thanks for any answer, here is my current setup:

    http://i.imgur.com/Nrrat3j.png?1[/code:1rx64nho]("Launcher" is slightly elevated)
    (I don't expect you to deal with the mess of my capx)
    
    (Btw, I took a look at the bullet launch in the debug view and figured that on launch, the bullet's vx0 is the set Bullet.Speed and vy0 is always 0, maybe that's an issue here..)
  • newt Thanks, that works perfectly. I thought you meant some kind of behaviour expression.

    What does the "dt" do again? I understand what the "dt" expression does on its own, but what does it do in this expression?

    Does it ensure that the missile just turns when a frame is being rendered and not every tick?

  • I just found this thread: scirra.com/forum/viewtopic.php

    Wonder why I didn't find that through the search function...

    I'm sorry for repeating this question, I'll try your solution and try the solutions from the thread.

    [EDIT: I tried your solution @badmoodtyler, but it keeps turning in a counter-clockwise direction, so it always chooses the second option which actually can't be possible.. :( I'd love to send you a video but my internet won't allow it..]

  • newt

    Thanks for the reply!

    You probably meant "anglelerp(self.angle,angle(self.x,self.y,target.x,target.y),turningspeed*dt)" right?

    Do you take the turning speed from the turret behaviour?

    Like this? i.imgur.com/DLnW3TE.png

    The setting I have now results in some pretty heavy jittering of the bullet (I would upload a gif but I'm in a remote location atm and the internet is via satellite and thus, really slow).

  • You can go with the NW.js object, and add the "Run file" action.

    Though that would mean that you would have to:

    1) export the project as an NW.js application

    2) store the .pptx file on a temporary local location to be able to run it via the NW.js action

  • The first question would be how you are storing the username.

    Are you storing it as a global variable or as a dicitonary value or as an XML value?

    The way you would check whether the name already exists, varies depending on how you store the usernames for your chatroom.

  • The background:

    In my current little project, I created a rocket (with the bullet behaviour) and a moving target.

    The rocket (obviously) has a specific, constant speed and the target is moving horizontally by using the 'Sine' behaviour.

    I now want to implement an option to make the rocket act as if it was a homing missile.

    This means that I want the rocket to head towards the targets direction, considering the own speed and angle and the targets movement direction and speed (though it isn't constant).

    I don't want a ridiculously long function, but it should not just be

    Set Self.Angle towards position Target.X, Target.Y[/code:1qslgdh9]
    
    [b]My thoughts:[/b]
    Initially, I used exactly that action which (of course) didn't have a high success rate, since the target is moving.
    
    So I considered giving the rocket the 'Turret' behaviour, setting it to 'Predicted aim' and control the angle by that.
    That worked quite well.
    I can even control the rockets accuracy with the turret's turning speed and the range.
    
    My question is now whether there is any way to control the rocket which works even better than that?
    I just started using C2 (two weeks ago) and I know that this is quite ambitious, but I wanna see where I can get and I know that this awesome community is always up for a challenge. ;)
    
    Here is an image of my current function:
    http://i.imgur.com/gHmy7Gd.png (sorry can't make it clickable yet)
    
    Have a nice day, thanks for any reply! :)
  • Here's an example I created on how you could do it.

    The version is very buggy but I think it demonstrates well how you could do it.

    Download:

    dropbox.com/s/ynca7s7w74vkf22/JumpNuts.capx

  • Yes, that is possible.

    Actually, that would be very easy once you start to understand C2.

    You don't need much knowledge of C2 for a trivia game, just start learning the basic mechanics of it and you'll be good to go!

    Here's a tutorial to begin with: scirra.com/tutorials/37/beginners-guide-to-construct-2

    Have fun! :)

  • tunepunk mrinmoysd

    Yeah that's the way, I'd do it too.

    When you click, your player is given a speed by an action and set loose from the ball, making him fly towards the next ball in a physically correct way (caused by the bullet behaviour).

    As soon as he touches the next ball, the coordinates are being saved. The angle of the ball would then have to be switched towards the player (to be able to calculate his position on the ball).

    his position can then be calculated like so:

    x position: ball.x (make hit-spot -> center) + ball.radius*(cos(ball.angle)) | you'll have to calculate the radius from the size of the sprite.

    y position would be similar, just with sinus.

    I hope we could help you, if you need any more help, just write us.

  • Hi,

    could you provide us with some more information?

    Maybe a .capx and a detailed explanation of your problem & project and what you mean by "node"?

    Thanks.

  • So, if I understand you correctly, you don't need to change LevelCtr value when the level you choose is lower than the maximum level you reached right?

    I would say that you need to get the LevelCtr from LocalStorage as soon as you start the game. That's probably the one and only time in your game where you should get the value from the LocalStorage, since the global variable "LevelCtr" isn't dependant on the LocalStorage Key.

    You just need to check the LocalStorage Key when you start the game.

    At the beginning of every level, you should check whether the current level's number is higher than the current LevelCtr and if that is the case, save the level's number as the LocalStorage "LevelCtr_Key".

    Lastly, when the user quits the game, the current "LevelCtr" should be saved to the LocalStorage, in case, the "LevelCtr" variable has increased since the last change of the "LevelCtr_Key".

    This should work, in theory.

    Your images look like you don't have many events, so I'd be happy if you could provide me with a .capx so that I can refer to the event sheet context too. Thanks. :)

  • Hi, if you'd give us a link of that game you are referring to, that's be very helpful.

    I can't find it on the web.

    Or if you would describe the movement needed.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So, what exactly does the LevelCtr (global) value store? Does it store the amount of levels you have already played? Or the number of the level from which you quit the game last time?

    I can see that you use the LocalStorage object correctly, I think the problem you are having is caused by the use of the variable. If you could tell us more about your LevelCtr variable, me might be able to solve your problem. :)

  • Thanks so much for taking the time and creating this (beautifully named) project for me.

    My first ever time I ask for help in this forum and I immediately get such a friendly response.

    This community is awesome.

    I read through the .capx you provided. I fixed my project now by changing the Angle check to the one that you proposed (Pick shell where int(Shell.Bullet.AngleOfMotion) > 0) which also allowed me to remove the now unnessecary UID instance variable.

    I also removed the CheckShellMovement function which isn't needed now anymore because I can just pick the needed shells.

    Thanks so much for taking the time to take care of my issue. If you have a problem at some point (maybe with particles), I will do my best do help you too.

    Also, thanks to DankP3 for proposing the global variable to be changed to an instance variable. Would probably have fixed my problem too.

    Now I have a compact and working new version of my project, thanks everyone.

    (Btw, 99Instances2Go, you said there are too many "If->Then" in my project? Could you tell me how I can improve this? Not in this thread, but via PM maybe? I don't have gained the power of writing PM's yet though. Maybe you could send me one quickly? Just if you have the time of course.)