Pool table tutorial question
SingleSparq
Member Posts: 1,339
Hi, (codemonkey) I tried to apply what you have done on the pool table tutorial for my game but am having issues.
I've added the actors for Arrow, Reticule and Connector (BTW - should these be actual image represented actors?) and the cueball but I see a line or arrow showing up and all I'm getting is that it takes a few mouse clicks on the ball that makes it go back and forth one direction - I have no drag direction control.
The only clue to an where the issue lies is in cueball where the change velocity setting is vectorToAngle( game.CueX - game.ReticuleX , game.CueY - game.ReticuleY ) seems to have the same effect as if it were just 0 - putting a number like 30 at lease changes the ball to move that direction but not exactly what were trying to achieve here.
As I have poured over the code to see what I may have put in wrong I can see no issues.
Note in the tutorial it says:
'CueX : Cueball's X position (real type)
CueY : Cueball's Y position (real type)
SettingShot : Boolean signifying if you are lining up your shot
ReticuleX : X Position of the mouse at all times (real type)
ReticuleY : Y Position of the mouse at all times (real type)'
I'm assuming were not changing the values there unless instructed.
Any thought to what the problem might be?
I've added the actors for Arrow, Reticule and Connector (BTW - should these be actual image represented actors?) and the cueball but I see a line or arrow showing up and all I'm getting is that it takes a few mouse clicks on the ball that makes it go back and forth one direction - I have no drag direction control.
The only clue to an where the issue lies is in cueball where the change velocity setting is vectorToAngle( game.CueX - game.ReticuleX , game.CueY - game.ReticuleY ) seems to have the same effect as if it were just 0 - putting a number like 30 at lease changes the ball to move that direction but not exactly what were trying to achieve here.
As I have poured over the code to see what I may have put in wrong I can see no issues.
Note in the tutorial it says:
'CueX : Cueball's X position (real type)
CueY : Cueball's Y position (real type)
SettingShot : Boolean signifying if you are lining up your shot
ReticuleX : X Position of the mouse at all times (real type)
ReticuleY : Y Position of the mouse at all times (real type)'
I'm assuming were not changing the values there unless instructed.
Any thought to what the problem might be?
Comments
The arrow, connector and crosshair stay stationary and need to move to the position that the ball ends up (I think) to avoid the problem. Any thoughts on how this could be achieved?
http://gamesalad.com/wiki/how_tos:gsc_drag_and_drop_movement#modifications_for_non-default_scene_size
I played around with Current Scene → Camera → Origin on the actors independent of the prototype but it went all bad.
Take a look at this expression that was in the reticule actor:
game.CueX +min(100, magnitude( game.CueX - game.Mouse.Position.X , game.CueY - game.Mouse.Position.Y ))*cos( vectorToAngle( game.Mouse.Position.X - game.CueX , game.Mouse.Position.Y - game.CueY ))
Assuming your mouse is always in the viewable area of the screen, its values area always between 0 and 480 on the X axis and 0 and 320 on the Y axis.
Now if you take the instructions from the link I sent in a previous reply, use the OffsetX and OffsetY defined there in the expression so it looks like:
game.CueX +min(100, magnitude( game.CueX - game.Mouse.Position.X + game.OffsetX , game.CueY - game.Mouse.Position.Y+game.OffsetY ))*cos( vectorToAngle( game.Mouse.Position.X + game.OffsetX - game.CueX , game.Mouse.Position.Y + game.OffsetY - game.CueY ))
I think that should work.
Then add the formula you suggest above to the offset constraints? Does this only apply to the reticule or must it be applied to other actors like cueball/arrow/connector?
Thanks for your help on this (once this is working it should be posted as a possible tutorial - good for larger scroll field games like a sim soccer or sim football)
Once you have game attributes that contain the camera offset, modify any actor that may require the mouse position for expressions.