Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - arj0n

#2581
The following code causes an object to move, how can I add "aClick.Play();" to this line?
The object should move and aClick should be played...


else if (((myobject.X+120<=oBlock4.X && myobject.Y-60==oBlock4.Y-120) && myobject.X <=420 &&
             myobject.ClickedRightHalf())) myobject.Move(myobject.X+60, myobject.Y, 10, eNoBlock, eAnywhere)

Sorry if this question is a bit silly but I can't figure it out myself at the moment... :-[
#2582
I'll kill 'em all, short IKEA.

No wait, that sucks...
#2583
Combattle 8) [2 overlapping words in one]
#2584
Just let me now and I'm on it  ;)
#2585
Good new Shay, looking forward to the demo  ;)
#2588
function oBlock2_AnyClick() works fine but
function oBlock4_AnyClick() doesn't, it only moves down.
Why is this or where is the code wrong?


// room script file
  bool ClickedRightHalf(this Object*) { //call when the object has been clicked
  if (mouse.x + GetViewportX() > (this.X + (Game.SpriteWidth[this.Graphic]/2))) return true;
  }
  bool ClickedLowerHalf(this Object*) { //call when the object has been clicked
  if (mouse.y + GetViewportY() > (this.Y + (Game.SpriteHeight[this.Graphic]/2))) return true;
  }

function oBlock2_AnyClick()
{
  //since you're not specifying any particular Object in your function,
  //I'll just get the one that the cursor is over for this example
  Object* myobject = Object.GetAtScreenXY(mouse.x, mouse.y);
  if ((myobject.X <=380 && myobject.ClickedRightHalf())) myobject.Move(myobject.X+100, myobject.Y, 10, eBlock, eAnywhere);
   //move x pixels to the right
  else if (myobject.X >=30 && !myobject.ClickedRightHalf())  myobject.Move(myobject.X-100, myobject.Y, 10, eBlock, eAnywhere);
  //move x pixels left

function oBlock4_AnyClick()
{
  //since you're not specifying any particular Object in your function,
  //I'll just get the one that the cursor is over for this example
  Object* myobject = Object.GetAtScreenXY(mouse.x, mouse.y);
  if ((myobject.Y >=30 && myobject.ClickedLowerHalf())) myobject.Move(myobject.X, myobject.Y-60, 10, eBlock, eAnywhere);
   //move x pixels up.
  else if (myobject.Y <=400 && !myobject.ClickedLowerHalf())  myobject.Move(myobject.X, myobject.Y+60, 10, eBlock, eAnywhere);
   //move x pixels Down.
}
#2589
Another question:

Say object1 moves only left or right and object2 can be in it's path.

How can check to prevent 2 objects colliding with each other?
Tried 'IsCollidingWithObject' but that doesn't prevent.
#2590
The object is still moving through its bounderies...

Edit: changed the <='number' and the >='number' , now it works.
#2591
Object should only be allowed to move when object.x is withing 20 and 530 [having the object horizontal size: 90].
Horizontal room size: 640.

This doesn't seem to work...:

function Block_AnyClick()
{
 Object* myobject = Object.GetAtScreenXY(mouse.x, mouse.y);
 if ((myobject.X <=530 && myobject.ClickedRightHalf())) myobject.Move(myobject.X+100, myobject.Y, 10, eBlock, eAnywhere);
 //move left
 else if (myobject.X >=20)  myobject.Move(myobject.X-100, myobject.Y, 100, eBlock, eAnywhere);
 //move right
}
#2593
Changed this:
if (mouse.x + GetViewportX()) > (this.X + (Game.SpriteWidth[this.Graphic]/2)) return true;
into this:
if (mouse.x + GetViewportX() > (this.X + (Game.SpriteWidth[this.Graphic]/2))) return true;

That seems to work but when running the 'game' and clicking on the object,
the cursor changes into the watch-cursor and nothing happens anymore...
???


Code that seems to work when saving the room but not when running the game:

// room script file
  bool ClickedRightHalf(this Object*) { //call when the object has been clicked
  if (mouse.x + GetViewportX() > (this.X + (Game.SpriteWidth[this.Graphic]/2))) return true;
}

function Block_AnyClick()
{
  //since you're not specifying any particular Object in your function,
  //I'll just get the one that the cursor is over for this example
  Object* myobject = Object.GetAtScreenXY(mouse.x, mouse.y);
  //move ten pixels to the right, or whatever you want to do
  if (myobject.ClickedRightHalf()) myobject.Move(myobject.X+10, myobject.Y, 10, true);
  //move ten pixels left
  else myobject.Move(myobject.X-10, myobject.Y, 10, true);
}
#2594
Sorry but here's noob again...
This is not working, getting an error:  
"PE04: parse error at '>:'"
for the line starting with ïf (mouse.x +..."):

// room script file
 bool ClickedRightHalf(this Object*) { //call when the object has been clicked
 if (mouse.x + GetViewportX()) > (this.X + (Game.SpriteWidth[this.Graphic]/2)) return true;
}

function Block_AnyClick()
{
 //since you're not specifying any particular Object in your function,
 //I'll just get the one that the cursor is over for this example
 Object* myobject = Object.GetAtScreenXY(mouse.x, mouse.y);
 //move ten pixels to the right, or whatever you want to do
 if (myobject.ClickedRightHalf()) myobject.Move(myobject.X+10, myobject.Y, 10, true);
 //move ten pixels left
 else myobject.Move(myobject.X-10, myobject.Y, 10, true);
}
#2595
Placed an object in a room, gave the object a scriptname, using "any click on opbject", code:

function moveblockhorizontal_AnyClick()
{
bool ClickedRightHalf(this Object*) { //call when the object has been clicked
  if (mouse.x + GetViewportX()) > (this.X + (Game.SpriteWidth[this.Graphic]/2)) return true;
}

This dowsn't seem to work.
What am I doing wrong?
#2596
Updated: v1.3 [room bug fixed].
#2597
Thanx, I'll check it out later.
For now I think the object(s) won't be scaled
#2598
In order to get an object to move right or left x pixels I'd like to know,
if it's possible to determine if the mouse pointer clicks on the right half
or on the left half of an object.

#2599
@Stupot:

Thanx.

I think I'm not always capable to determine the art style category
of a background, but I can give it a try  ;)

The backgrounds can indeed belong to any number of different
categories and a user defined gallery is something to think off. :)
#2600
Man, I wish I was 13 again!  :D
SMF spam blocked by CleanTalk