Please login or register.

Login with username, password and session length
Advanced search  

News:

This forum provides RSS feed. To query recent posts use this url. More...


Author Topic: Moving object  (Read 1370 times)

0 Members and 1 Guest are viewing this topic.

coderMan

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 3
  • Day Programmer Night Coder
    • View Profile
Moving object
« on: September 29, 2011, 08:42:06 PM »

Hello to all, i am new to scripting and i would like to get some help,here is what i want to do :
A 2d square in the screen that moves on x axis to left and right by the control of player, and also not moves off the screen, Another 2d square that falls towards the ground from the top of the screen. if anyone care to help me i would be thankful. good luck.
« Last Edit: September 29, 2011, 09:09:55 PM by coderMan »
Logged

keybone

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 112
    • View Profile
    • Lucine
Re: Moving object
« Reply #1 on: September 30, 2011, 12:54:58 PM »

I done it in in this way:

#include "scripts\base.inc"

var Vcube = Scene.GetNode("Name Sprite of the 2d in editor of the cube"); //sprite 2d

on "Keypress"
{
while(Keyboard.IsKeyDown(VK_RIGHT))
  {
   Vcube.X= 20 ;  //pos on x      
   Sleep(10);
  }

while(Keyboard.IsKeyDown(VK_LEFT))
  {
   Vcube.X= -20 ;  //pos on -x      
   Sleep(10);
  }
}


I'm not sure it works, it should go. Unfortunately I am not a great programmer.



Logged
Lucine Company http://www.lucine.it/
Tales of Lucine: The Realm of Hobdark http://www.lucine.it/TalesOfLucine

coderMan

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 3
  • Day Programmer Night Coder
    • View Profile
Re: Moving object
« Reply #2 on: September 30, 2011, 03:01:00 PM »

Hello my friend, this will be a reference for me, i will use it now , thanks alot,goodluck.
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5674
    • View Profile
    • Dead:Code Site
Re: Moving object
« Reply #3 on: October 01, 2011, 08:49:34 AM »

coderMan: If you need more help, just say it. There's no need to send me private messages with the same question (see my signature) or register a new account to ask again.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave
 

Page created in 0.228 seconds with 17 queries.